Skip to main content
Version: 8.x

How to Deploy a Codeigniter 4 Project

require 'recipe/codeigniter4.php';

Source

Deployer is a free and open source deployment tool written in PHP. It helps you to deploy your Codeigniter 4 application to a server. It is very easy to use and has a lot of features.

Three main features of Deployer are:

  • Provisioning - provision your server for you.
  • Zero downtime deployment - deploy your application without a downtime.
  • Rollbacks - rollback your application to a previous version, if something goes wrong.

Additionally, Deployer has a lot of other features, like:

  • Easy to use - Deployer is very easy to use. It has a simple and intuitive syntax.
  • Fast - Deployer is very fast. It uses parallel connections to deploy your application.
  • Secure - Deployer uses SSH to connect to your server.
  • Supports all major PHP frameworks - Deployer supports all major PHP frameworks.

You can read more about Deployer in Getting Started.

The deploy task of Codeigniter 4 consists of:

The codeigniter4 recipe is based on the common recipe.

Configuration

public_path

Source

Overrides public_path from recipe/provision/website.php.

Default Configurations

Default value
'public'

shared_dirs

Source

Overrides shared_dirs from recipe/deploy/shared.php.

Default value
['writable']

shared_files

Source

Overrides shared_files from recipe/deploy/shared.php.

Default value
['.env']

writable_dirs

Source

Overrides writable_dirs from recipe/deploy/writable.php.

Default value
[
'writable/cache',
'writable/debugbar',
'writable/logs',
'writable/session',
'writable/uploads',
]

log_files

Source

Default value
'writable/logs/*.log'

codeigniter4_version

Source

Default value
$result = run('{{bin/php}} {{release_or_current_path}}/spark');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.5;

Tasks

spark:cache:info

Source

Shows file cache information in the current system.

Discover & Checks

spark:config:check

Source

Check your Config values.

spark:env

Source

Retrieves the current environment, or set a new one.

spark:filter:check

Source

Check filters for a route.

spark:lang:find

Source

Find and save available phrases to translate.

spark:namespaces

Source

Verifies your namespaces are setup correctly.

spark:phpini:check

Source

Check your php.ini values.

spark:routes

Source

Displays all routes.

spark:​key:generate

Source

Generates a new encryption key and writes it in an .env file.

Actions

spark:optimize

Source

Optimize for production.

spark:publish

Source

Discovers and executes all predefined Publisher classes.

spark:db:create

Source

Create a new database schema.

Database and migrations.

spark:db:seed

Source

Runs the specified seeder to populate known data into the database.

spark:db:table

Source

Retrieves information on the selected table.

spark:migrate

Source

Locates and runs all new migrations against the database.

spark:migrate:refresh

Source

Does a rollback followed by a latest to refresh the current state of the database.

spark:migrate:rollback

Source

Runs the "down" method for all migrations in the last batch.

spark:migrate:status

Source

Displays a list of all migrations and whether they've been run or not.

spark:cache:clear

Source

Clears the current system caches.

Housekeeping

spark:debugbar:clear

Source

Clears all debugbar JSON files.

spark:logs:clear

Source

Clears all log files.

spark:custom

Source

Run a custom spark command.

Custom Spark Command for shield or setting packages

deploy

Source

Deploys your project.

Main deploy task.

This task is group task which contains next tasks: