CLI 커맨드
CI4의 BaseCommand를 사용하여 spark 커맨드를 만들고 실행하는 방법을 알아봅니다.
등록된 Playground 명령어 (php spark list Playground)
CodeIgniter v4.7.3 Command Line Tool - Server Time: 2026-05-27 15:03:06 UTC+00:00
Cache
cache:clear Clears the current system caches.
cache:info Shows file cache information in the current system.
CodeIgniter
config:check Check your Config values.
env Retrieves the current environment, or set a new one.
filter:check Check filters for a route.
help Displays basic usage information.
list Lists the available commands.
namespaces Verifies your namespaces are setup correctly.
optimize Optimize for production.
phpini:check Check your php.ini values in production environment.
publish Discovers and executes all predefined Publisher classes.
routes Displays all routes.
serve Launches the CodeIgniter PHP-Development Server.
Database
db:create Create a new database schema.
db:seed Runs the specified seeder to populate known data into the
database.
db:table Retrieves information on the selected table.
migrate Locates and runs all new migrations against the database.
migrate:refresh Does a rollback followed by a latest to refresh the current
state of the database.
migrate:rollback Runs the "down" method for all migrations in the last batch.
migrate:status Displays a list of all migrations and whether they've been
run or not.
Encryption
key:generate Generates a new encryption key and writes it in an `.env`
file.
Generators
make:cell Generates a new Controlled Cell file and its view.
make:command Generates a new spark command.
make:config Generates a new config file.
make:controller Generates a new controller file.
make:entity Generates a new entity file.
make:filter Generates a new filter file.
make:migration Generates a new migration file.
make:model Generates a new model file.
make:scaffold Generates a complete set of scaffold files.
make:seeder Generates a new seeder file.
make:test Generates a new test file.
make:transformer Generates a new transformer file.
make:validation Generates a new validation file.
Housekeeping
debugbar:clear Clears all debugbar JSON files.
logs:clear Clears all log files.
Playground
playground:reset 플레이그라운드 데이터·업로드 파일·캐시를
초기 상태로 리셋합니다.
playground:seed 샘플 게시물을 데이터베이스에 추가합니다.
playground:stats 게시물 통계를 출력합니다.
Translation
lang:find Find and save available phrases to translate.
lang:sync Synchronize translation files from one language to another.
Worker Mode
worker:install Install FrankenPHP worker mode by creating necessary
configuration files
worker:uninstall Remove FrankenPHP worker mode configuration files
명령어 실행 (웹에서 시뮬레이션)
실제로는 터미널에서
php spark <command>로 실행합니다. 여기서는 웹에서 결과를 미리 확인합니다.