The zero executable provides a light command-line interface for common development tasks.
The script ships with the repository; ensure it is executable:
chmod +x zerophp zero serve [--host=127.0.0.1] [--port=8000] [--root=public] [--watch] [--franken] [--swolee]--host,--port, and--rootmirror PHP's built-in server options (defaults fall back to theHOST,PORT, andDOCROOTenvironment variables when present).--watchenables a basic file watcher that restarts the server on changes.--frankenand--swoleeexpose experimental server backends.
php zero make:controller PostsControllerCreates app/controllers/PostsController.php with a simple index action. Append --force to overwrite an existing file. The generator will add the Controller suffix automatically if it is not present.
php zero make:service Billing/InvoiceCreates app/services/Billing/Invoice.php, keeping the provided name intact and creating nested directories on demand. Use --force to overwrite an existing class. Both forward slashes and backslashes are accepted in the name.
php zero make:helper randomTextCreates app/helpers/RandomText.php with a helper skeleton that exposes a default signature derived from the class name. Register the helper in app/helpers/Helper.php so it becomes available globally (for example, random_text(10)). Use --force to overwrite an existing helper.
php zero make:command HealthCheck --signature=app:healthCreates app/console/Commands/HealthCheck.php implementing the CommandInterface. The generator also ensures app/console/Commands/Command.php exists and appends the new command to its registration list so it is immediately available to the CLI. Provide --description="..." to customise the help text and --force to overwrite an existing command class.
php zero make:model PostCreates app/models/Post.php extending the base Zero\Lib\Model. Use --force to regenerate an existing model class.
php zero make:migration create_users_tableCreates a timestamped file in database/migrations. Each migration returns an anonymous class that extends Zero\Lib\DB\Migration with up() and down() methods.
Run outstanding migrations with:
php zero migrateRollback the latest batch:
php zero migrate:rollback [steps]Reset the database by rolling back every batch and rerunning all migrations:
php zero migrate:refreshDrop every table (ignoring individual down() methods) before running migrations from scratch:
php zero migrate:freshMigrations leverage the lightweight schema builder:
use Zero\Lib\DB\Schema;
use Zero\Lib\DB\Blueprint;
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});You can chain fluent modifiers on column definitions (e.g., $table->string('email')->nullable()->unique();).
Pass a number to migrate:rollback to reverse multiple batches, e.g. php zero migrate:rollback 2.
Modify tables with Schema::table:
Schema::table('users', function (Blueprint $table) {
$table->string('nickname', 50)->nullable();
$table->dropColumn('legacy_field');
});php zero make:seeder UsersTableSeederSeeders extend Zero\Lib\DB\Seeder and live in database/seeders. Execute a seeder with:
php zero db:seed Database\\Seeders\\UsersTableSeederphp zero make:middleware EnsureAdminCreates app/middlewares/EnsureAdminMiddleware.php with a handle() stub ready for authentication or authorization logic. Use --force to overwrite an existing file.
php zero storage:linkCreates symbolic links defined in config/storage.php (by default linking public/storage to the public disk). The command skips existing links and reports missing targets.
php zero log:clear [--channel=file] [--path=/absolute/log/path]Removes *.log files from the target directory. When --path is omitted the command resolves the directory from config/logging.php (defaulting to storage/framework/logs). Only log files are deleted—placeholder files (such as .gitignore) remain.
php zero db:dump [--connection=mysql] [--file=storage/database/dumps/backup.sql]Exports the configured database to an SQL dump. Provide --file to choose the destination path (relative paths are resolved against the current working directory); otherwise the dump is written to storage/database/dumps/<connection>-<timestamp>.sql. The command supports MySQL (mysqldump), PostgreSQL (pg_dump), and SQLite (just copies the database file).
php zero db:restore [--connection=mysql] [--file=storage/database/dumps/backup.sql]Restores an SQL dump back into the configured database. When --file is omitted the most recent dump in storage/database/dumps is used; specify an explicit path to restore a custom dump. The command supports MySQL (mysql), PostgreSQL (psql), and SQLite.
php zero route:listBootstraps routes/web.php and prints a table with the HTTP method, URI, route name (when available), controller action, and attached middleware stack. Use it to confirm route bindings after adding groups, name prefixes, or new controllers.
- Fetches a JSON manifest from the URL configured via
UPDATE_MANIFEST_URL. - Displays the target version and files that will be updated before applying changes.
- Downloads each file securely (with optional SHA-256 verification when provided in the manifest).
- Prompts for confirmation unless
--yesis supplied.
After updating, review release notes, clear caches, and run migrations as needed.
Stub templates live under core/templates. Adjust controller.tmpl, service.tmpl, or model.tmpl (or add new files) to change the generated skeletons.
Commands are dispatched from the zero script. New subcommands can be added by extending the switch statement and creating helper functions to encapsulate behaviour.