{"id":13518350,"url":"https://github.com/jolicode/castor","last_synced_at":"2025-03-31T09:31:30.266Z","repository":{"id":167177536,"uuid":"641983196","full_name":"jolicode/castor","owner":"jolicode","description":"🦫 DX oriented task runner and command launcher built with PHP.","archived":false,"fork":false,"pushed_at":"2025-03-24T10:26:28.000Z","size":9130,"stargazers_count":470,"open_issues_count":9,"forks_count":23,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-24T11:34:35.175Z","etag":null,"topics":["cli","command-line","command-line-tool","hacktoberfest","php-library","task-runner","tool"],"latest_commit_sha":null,"homepage":"https://castor.jolicode.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jolicode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T15:08:01.000Z","updated_at":"2025-03-24T10:26:31.000Z","dependencies_parsed_at":"2023-12-20T07:29:33.126Z","dependency_job_id":"7f5e1bba-c877-4be5-8f30-b71bcedf8273","html_url":"https://github.com/jolicode/castor","commit_stats":null,"previous_names":["jolicode/castor"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolicode%2Fcastor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolicode%2Fcastor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolicode%2Fcastor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolicode%2Fcastor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jolicode","download_url":"https://codeload.github.com/jolicode/castor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246446929,"owners_count":20778893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","command-line-tool","hacktoberfest","php-library","task-runner","tool"],"created_at":"2024-08-01T05:01:43.846Z","updated_at":"2025-03-31T09:31:30.256Z","avatar_url":"https://github.com/jolicode.png","language":"PHP","readme":"\n\u003ch1 align=\"center\"\u003e\n    \u003cimg width=\"450\" height=\"117\" src=\"https://jolicode.com/media/original/castor-logo-line.svg?cool\" alt=\"castor logo\" /\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ci\u003eCastor is a \u003cstrong\u003e\u003cabbr title=\"Developer eXperience\"\u003eDX\u003c/abbr\u003e-oriented task\n    runner\u003c/strong\u003e built in PHP featuring a range of functions for common task processing.\u003c/i\u003e\n\u003c/p\u003e\n\nIt can be viewed as an alternative to Makefile, Fabric, Invoke, Shell scripts,\netc., but it leverages PHP's scripting capabilities and extensive library ecosystem.\n\nIt comes with many features to make your life easier:\n\n* Seamless parsing of **arguments and options**, simplifying input handling\n* **[Autocomplete](https://castor.jolicode.com/going-further/interacting-with-castor/autocomplete)** support for faster and error-free typing\n* A built-in list of useful functions:\n    * [`run()`](https://castor.jolicode.com/getting-started/run/#the-run-function): Run external processes, enabling seamless integration with external tools\n    * [`io()`](https://castor.jolicode.com/going-further/helpers/console-and-io/#the-io-function): Display beautiful output and interacts with the terminal\n    * [`watch()`](https://castor.jolicode.com/going-further/helpers/watch/): Watch files and automatically triggers actions on file modifications\n    * [`fs()`](https://castor.jolicode.com/going-further/helpers/filesystem/#the-fs-function): Create, remove, and manipulate files and directories\n    * [And even more advanced functions](https://castor.jolicode.com/reference/)\n\n\u003e [!NOTE]\n\u003e Castor is still in early development, and the API is not stable yet. Even if\n\u003e it is unlikely, it is still possible that it will change in the\n\u003e future.\n\n## Usage\n\nIn Castor, tasks are set up as typical PHP functions marked with the `#[AsTask()]` attribute in a `castor.php` file.\n\nThese tasks can run any PHP code but also make use of various [functions for standard operations](https://castor.jolicode.com/reference/) that come pre-packaged with Castor.\n\nFor example:\n\n```php\n\u003c?php\n\nnamespace greetings;\n\nuse Castor\\Attribute\\AsTask;\nuse function Castor\\io;\n\n#[AsTask()]\nfunction hello(): void\n{\n    io()-\u003ewriteln('Hello from castor');\n}\n```\n\nWill expose a `greetings:hello` task that you can run with `castor greetings:hello`:\n\n```bash\n$ castor greetings:hello\nHello from castor\n```\n\nThen, you can go wild and create more complex tasks:\n\n```php\n#[AsTask(description: 'Clean the infrastructure (remove container, volume, networks)')]\nfunction destroy(bool $force = false)\n{\n    if (!$force) {\n        io()-\u003ewarning('This will permanently remove all containers, volumes, networks... created for this project.');\n        io()-\u003ecomment('You can use the --force option to avoid this confirmation.');\n\n        if (!io()-\u003econfirm('Are you sure?', false)) {\n            io()-\u003ecomment('Aborted.');\n\n            return;\n        }\n    }\n\n    run('docker-compose down -v --remove-orphans --volumes --rmi=local');\n\n    notify('The infrastructure has been destroyed.')\n}\n```\n\nIf you want to read more about usage, you can read the\n[basic usage](https://castor.jolicode.com/getting-started/) documentation, or\nwatch [some examples](https://castor.jolicode.com/examples/).\n\n## Installation\n\n### With the installer\n\n\u003e [!TIP]\n\u003e This is the recommended way to install Castor on Linux and macOS. It requires PHP \u003e= 8.2.\n\n```bash\ncurl \"https://castor.jolicode.com/install\" | bash\n```\n\nThere are other ways to install Castor, please refer to the\n[documentation](https://castor.jolicode.com/getting-started/installation/).\n\n## Further documentation\n\nDiscover more by reading the docs:\n\n* [Getting started with Castor](https://castor.jolicode.com/getting-started/)\n  * [Installation and Autocomplete](https://castor.jolicode.com/getting-started/installation/)\n  * [Basic Usage](https://castor.jolicode.com/getting-started/basic-usage/)\n  * [Executing Processes with `run()`](https://castor.jolicode.com/getting-started/run/)\n  * [Task Arguments](https://castor.jolicode.com/getting-started/arguments)\n  * [Using the Context](https://castor.jolicode.com/getting-started/context)\n* [Going further with Castor](https://castor.jolicode.com/going-further/)\n* [Castor reference](https://castor.jolicode.com/reference/)\n* [Examples](https://castor.jolicode.com/examples/)\n* [Frequently asked questions](https://castor.jolicode.com/faq/)\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjolicode%2Fcastor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjolicode%2Fcastor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjolicode%2Fcastor/lists"}