Atomic CLI Entrypoint
When to Use
- When verifying or creating the project-level CLI stub file (the executable that dispatches console commands).
- When documenting how to run
php atomicor execute theatomicfile directly.
Purpose
This file is the tiny, project-root executable that boots Composer autoload, loads the application bootstrap and delegates CLI control to the framework.
Recommended filename and location
Place the file in the project root as atomic (preferred) or atomic.php.
Make it executable (chmod +x atomic) so it can be run directly (./atomic).
Entrypoint script (exact)
#!/usr/bin/env php
<?php
define('ATOMIC_START', microtime(true));
require __DIR__.'/vendor/autoload.php';
global $argv;
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handle_command($argv);
exit($status);
Notes
bootstrap/app.phpMUST return the application/container instance exposinghandle_command(array $argv): int.- Use
./atomic helporphp atomic helpto list available commands. - The script should be intentionally minimal: autoload, bootstrap, delegate, exit.
Examples
./atomic helpphp atomic init
Troubleshooting
- If commands do not appear, verify
bootstrap/app.phpreturns a valid application androutes/cli.phpis loaded by the bootstrap. - Ensure
vendor/autoload.phpexists (runcomposer install).