SIMPLY CLI

Last updated: June 29th 2026

Creating Controller

Simply-PHP has a command line utility that will do some complex task for you.

To create a controller run

$ php cli make:controller product

this command will generate a ProductController.php file in Controllers folder.

You can also pass option to make a controller resource:

$ php cli make:controller product -r

it will make an

Options:

  • -r ➤To make the created controller a resource controller(needed actions to make CRUD)
  • -m ➤To make also the model by default for that controller.

Creating Model

To create a model run

$ php cli make:model product

this command will generate a Product.php file in app folder. This will be your model for product controller.

Creating Observer

Observers hook into model lifecycle events. To create one run

$ php cli make:observer User

This generates an UserObserver.php file in app/Observers/. Register it in EventServiceProvider::boot() via User::observe(UserObserver::class).

See Model Observers docs for details.

Creating Migrations

Generate a class-based migration file:

$ php cli make:migration create_users_table

This creates a timestamped file in database/migrations/ with an anonymous class that extends Simple\Database\Migrations\Migration. The table name is inferred from the migration name (e.g. create_users_table generates a migration for the users table).

See the Migrations documentation for details on writing migration classes.

Running Migrations

Apply all pending migrations:

$ php cli migrate

This runs any migration files in database/migrations/ that have not yet been applied. A migrations table tracks which migrations have run.

Fresh Migrate

Drop all tables and re-run all migrations from scratch:

$ php cli migrate:fresh

Useful during development when you want to rebuild your entire database schema.

Generate Authentication Files

Simply PHP provides a quick way to scaffold all of the routes and views you need for authentication using one simple command

$ php cli make:auth

This will generate files needed for authentication like login, registration, forgot-password and all the necessary files like controllers, models and helpers

make:auth now automatically creates a users migration in database/migrations/ and runs pending migrations — no manual steps needed. The migration includes id, name, email, password_hash, email_verified_at, remember_token, and timestamps columns.

Manual Seeding

Seed any model with data directly from the CLI. The model name is converted to StudlyCase to find the class in app/Models/.

$ php cli user:seed — seeds App\Models\User

$ php cli product:seed — seeds App\Models\Product

$ php cli order_item:seed — seeds App\Models\OrderItem

How it works

  1. The command resolves the model class from the command name (e.g. user:seedApp\Models\User)
  2. It reads the model's $fillable array to determine which fields to prompt for
  3. Each fillable field is prompted interactively
  4. After all fields are entered, a record is created via Model::create()
  5. You're asked if you want to seed another entry — type yes to repeat

Special field handling

Field pattern Behavior
password, password_hash, password_confirmation Auto-hashed with password_hash() using PASSWORD_BCRYPT
email_verified_at, email_verified, verified_at, email_verified_date Accepts a timestamp (YYYY-MM-DD HH:MM:SS) or blank for null
All other fields Plain text input stored as-is

Requirements

  • The model must exist in app/Models/ and be autoloadable
  • The model must define a $fillable array
  • The corresponding database table must already exist (run php cli migrate first)
  • The database connection must be configured in app/Config/database.php

PHP AND MYSQL MUST BE IN THE ENVIRONMENT PATH VARIABLE

If your using xampp below is the step how to add php on environment variable

Please set Environment Variable as per below mention steps.

  1. Right Click on MY Computer Icon and Click on Properties or Go to "Control Panel\System and Security\System".
  2. Select "Advanced System Settings" and select "Advance" Tab
  3. Now Select "Environment Variable" option and select "Path" from "System Variables" and click on "Edit" button
  4. Now set path where php.exe file is available - For example if XAMPP install in to C: drive then Path is "C:\xampp\php"
  5. After set path Click Ok and Apply.

For mysql

  1. "C:\xampp\mysql\bin" should also be added to "Path"