CLI

SigmaPHP includes a built-in Command Line Interface (CLI) that helps automate many common development tasks such as generating application components, running migrations, seeding databases, and managing caches.

The CLI tool helps speed up development by reducing repetitive tasks and ensuring that files follow the framework's recommended structure.

All commands can be executed using the sigma-cli executable located inside the bin directory.


./bin/sigma-cli help

Windows Users

If you are using Windows, you can execute the CLI commands using the sigma-cli.bat file instead.


.\bin\sigma-cli.bat help

Available Commands

clear:cache

Clear the cached compiled views.


./bin/sigma-cli clear:cache

create:controller {controller name}

Generate a new controller class.


./bin/sigma-cli create:controller UserController

create:middleware {middleware name}

Generate a new middleware class.


./bin/sigma-cli create:middleware AuthMiddleware

create:migration {migration name}

Generate a new migration file used for managing database schema changes.


./bin/sigma-cli create:migration create_users_table

create:model {model name}

Create a new model class. This command will also automatically generate a corresponding migration file for the model.


./bin/sigma-cli create:model User

create:provider {service provider name}

Generate a new service provider used to register dependencies and services inside the container.


./bin/sigma-cli create:provider AppServiceProvider

create:secret

Generate a new application secret key and automatically save it into the .env file.


./bin/sigma-cli create:secret

create:seeder {seeder name}

Generate a database seeder class used to populate tables with sample or initial data.


./bin/sigma-cli create:seeder UserSeeder

create:uploads

Create the uploads directory used to store uploaded files.


./bin/sigma-cli create:uploads

create:view {view name}

Generate a new view template file.


./bin/sigma-cli create:view users/index

drop

Drop all tables in the configured database.


./bin/sigma-cli drop

fresh

Drop all tables in the database, then run all migrations and seed the database again.


./bin/sigma-cli fresh

help

Display all available CLI commands.


./bin/sigma-cli help

migrate {migration name}

Run one or multiple migration files.


./bin/sigma-cli migrate

rollback {date}

Rollback the latest migration or rollback to a specific migration date.


./bin/sigma-cli rollback

run {port}

Run the application using PHP's built-in development server. By default, it runs on port 8888, but you can specify a custom port if needed.


./bin/sigma-cli run

seed {seeder name}

Run one or more database seeders.


./bin/sigma-cli seed UserSeeder

test

Execute the application's unit tests.


./bin/sigma-cli test

truncate

Delete all data from every table in the database without removing the table structure.


./bin/sigma-cli truncate

version

Display the current version of the SigmaPHP framework.


./bin/sigma-cli version
Back to top