jolicode / castor
DX oriented task runner and command launcher built with PHP
Installs: 36 741
Dependents: 3
Suggesters: 0
Security: 0
Stars: 480
Watchers: 16
Forks: 22
Open Issues: 8
Type:project
Requires
- php: >=8.2
- composer/composer: ^2.8.9
- jolicode/jolinotif: ^3.1.1
- jolicode/php-os-helper: ^0.2
- monolog/monolog: ^3.9.0
- nikic/php-parser: ^5.5.0
- phpstan/phpdoc-parser: ^2.1.0
- spatie/ssh: ^1.13.0
- symfony/cache: ^7.3.0
- symfony/config: ^7.3.0
- symfony/console: ^7.3.0
- symfony/dependency-injection: ^7.3.0
- symfony/deprecation-contracts: ^3.6.0
- symfony/dotenv: ^7.3
- symfony/error-handler: ^7.3.0
- symfony/expression-language: ^7.3
- symfony/filesystem: ^7.3
- symfony/finder: ^7.3.0
- symfony/http-client: ^7.3.0
- symfony/monolog-bridge: ^7.3
- symfony/process: ^7.3.0
- symfony/string: ^7.3
- symfony/translation-contracts: ^3.6.0
- symfony/var-dumper: ^7.3.0
- symfony/yaml: ^7.3.0
Requires (Dev)
- phpunit/php-code-coverage: ^9.2.32
- symfony/phpunit-bridge: ^7.3
- dev-main
- v0.25.0
- v0.24.0
- v0.23.0
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.1
- v0.19.0
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.1
- v0.17.0
- v0.16.0
- v0.15.0
- v0.14.0
- v0.13.1
- v0.13.0
- v0.12.1
- v0.12.0
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.2
- v0.5.1
- v0.5
- v0.4.1
- v0.4
- v0.3
- v0.2
- v0.1
- dev-dumper2
- dev-dumper
- dev-feat/context-array
- dev-feat/remote-execute
- dev-feat/tools
This package is auto-updated.
Last update: 2025-06-26 14:00:52 UTC
README
Automate everything. In PHP.
Simply. Efficiently. Elegantly.π TL;DR
Castor is a lightweight, modern task runner for PHP.
No need for Bash, Makefiles or YAML.
Write your automation scripts in PHP, run them from the CLI.
- β 100% PHP β define tasks as simple PHP functions
- β‘ Fast & native β no configuration, no boilerplate
- π§ Provided with a bunch of useful built-in functions
- π§ Autocompletion & descriptions for each task
- π§° Easy to integrate in your dev workflows
π€ Presentation
Castor is a DX-oriented task runner built in PHP featuring a range of functions for common task processing.
It can be viewed as an alternative to Makefile, Fabric, Invoke, Shell scripts, etc., but it leverages PHP's scripting capabilities and extensive library ecosystem.
It comes with many features to make your life easier:
- Seamless parsing of arguments and options, simplifying input handling
- Autocomplete support for faster and error-free typing
- A built-in list of useful functions:
run()
: Run external processes, enabling seamless integration with external toolsio()
: Display beautiful output and interacts with the terminalwatch()
: Watch files and automatically triggers actions on file modificationsfs()
: Create, remove, and manipulate files and directories- And even more advanced functions
Note
While Castor hasn't reached v1.0 yet, any API changes are carefully managed with deprecation warnings and compatibility bridges.
π§βπ¬ Basic usage
In Castor, tasks are set up as typical PHP functions marked with the #[AsTask()]
attribute in a castor.php
file.
These tasks can run any PHP code but also make use of various functions for standard operations that come pre-packaged with Castor.
For example, the following castor.php file:
use Castor\Attribute\AsTask; #[AsTask()] function hello(): void { echo 'Hello from castor'; }
Will expose a hello
task that you can run with castor hello
:
$ castor greetings:hello Hello from castor
Then, you can go wild and create more complex tasks:
#[AsTask(description: 'Clean the infrastructure (remove container, volume, networks)')] function destroy(bool $force = false) { if (!$force) { io()->warning('This will permanently remove all containers, volumes, networks... created for this project.'); io()->comment('You can use the --force option to avoid this confirmation.'); if (!io()->confirm('Are you sure?', false)) { io()->comment('Aborted.'); return; } } run('docker-compose down -v --remove-orphans --volumes --rmi=local'); notify('The infrastructure has been destroyed.') }
β Want to see basic usages and main features of Castor? Read the Getting started documentation
π€ Why not Robo / Make / Symfony Console?
Because:
- Robo is too verbose and OOP-heavy
- Make is not PHP, and is hard to maintain in large projects
- Symfony Console is a great base β but Castor is built on top of it and gives you superpowers
β See detailed comparisons in our FAQ
π§° Get started in 10 seconds
curl "https://castor.jolicode.com/install" | bash castor
β Castor can also be installed in other ways (phar, static binaries, Composer), see the installation documentation.
π Want more?
Discover more by reading the docs: