jolicode/castor
Composer 安装命令:
composer create-project jolicode/castor
包简介
A lightweight and modern task runner. Automate everything. In PHP.
README 文档
README
A lightweight and modern task runner for Automation, CI/CD & DevOps.
Automate everything. In PHP. Simply. Efficiently. Elegantly.
Write your automation scripts in PHP, run them from the CLI.
No need for Bash, Makefiles or YAML.
- ✅ 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, that is designed to help you automate your development tasks and workflows in a simple and efficient way.
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
Get started in 10 seconds
curl "https://castor.jolicode.com/install" | bash castor
→ Castor can also be installed in many other ways (phar, static binaries, Composer, Github Action, etc), see the installation documentation.
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 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
Real-world use cases
- Run database migrations
- Deploy your app with one command
- Manage assets or translations
- Bootstrap environments
- Automate internal tools
→ See more examples from the community.
What developers say
"Finally a task runner that feels like PHP. No weird DSL, just functions."
— Every Castor user, probably
"I thought I needed Bash, Make, and half a DevOps degree. Turns out I just needed Castor."
— A surprisingly relieved developer
"We migrated from Make to Castor and nobody cried. That's a win."
— Senior Developer, now less grumpy
Why not Make / Robo / Phing / Deployer / Symfony Console?
Because:
- Make is not PHP, and is hard to maintain in large projects
- Others are either too verbose, OOP-heavy, requiring YML or XML configurations or are specialized in deployment only.
- Symfony Console is a great base - but Castor is built on top of it and gives you superpowers
→ See detailed comparisons in our FAQ
Want more?
Discover more by reading the docs:
jolicode/castor 适用场景与选型建议
jolicode/castor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43.02k 次下载、GitHub Stars 达 546, 最近一次更新时间为 2023 年 05 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「process」 「task」 「runner」 「async」 「parallel」 「castor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jolicode/castor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jolicode/castor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jolicode/castor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Parallel runner extension for Behat
Simple task scheduler for Neos Flow Framework
Doctrine implementation of the MetaborStd (Statemachine) for PHP 8.2+
Shell command module for PHP.
Swoole server process management
Expose the DDev executable commands to the Robo task runner.
统计信息
- 总下载量: 43.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 547
- 点击次数: 16
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-31