Welcome to serverless CodeIgniter

Documentation

User Guide

Requirements

  1. GitHub, GitLab, or Bitbucket account
  2. Vercel account
  3. PlanetScale account (optional)

Both Vercel & PlanetScale accounts can be connected via single sign-on (SSO)

Deploy to Vercel

Deploy with Vercel

Vercel Setup

After first deploy, navigate to SettingsEnvironment Variables and set the following variables.

Name: CI_ENVIRONMENT
Value: production

Name: app_baseURL
Value: your-custom.vercel.app

If using PlanetScale or other MySQL DB, set your custom connection credentials.

Name: DB_HOST
Value: us-east.connect.psdb.cloud

Name: DB_NAME
Value: db-name

Name: DB_USER
Value: username

Name: DB_PASS
Value: password

Environment Variables in Vercel's Docs

PlanetScale Setup

  1. Create new database
  2. Take special care to copy the generated password, as it is only shown once.
  3. Navigate to databaseBranchesmainconsole
  4. Import sample schema/data from: public/resources/demo.sql (optional for demo page)

‣ PlanetScale's quickstart guide

CodeIgnter Setup

Copy sample env file.

cp env .env

Setup database connectivity for your development environment, set the following variables in the .env file.

CI_ENVIRONMENT = development

# DB SETTINGS
database.default.hostname = us-east.connect.psdb.cloud
database.default.database = db-name
database.default.username = username
database.default.password = password

Start the PHP development Server.

php spark start

‣ PHP Version 7.4.13 by Vercel Community PHP.

‣ View PHP Info

‣ See CodeIgniter's PHP requirements.

Handling Multiple Environments in the CodeIgniter User Guide