• Stars
    star
    406
  • Rank 106,421 (Top 3 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 1 year ago
  • Updated 25 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🦫 DX oriented task runner and command launcher built with PHP.

castor logo

Castor is a DX oriented task runner and command launcher built with PHP.

It can be seen as a replacement of Makefile, Fabric, Invoke, Shell scripts...

It comes with many helpers to make your life easier:

  • Seamless parsing of arguments and options, simplifying input handling
  • Autocomplete support for faster and error-free command entry
  • Effortless process execution, enabling seamless integration with external tools
  • Parallel processing capabilities to maximize resource utilization
  • Intelligent file watching that automatically triggers actions on file modifications
  • Customizable notifications to keep you informed and in control
  • Robust logging for capturing and analyzing essential information
  • A strong emphasis on exceptional Developer Experience (DX)

Note
Castor is still in early development, and the API is not stable yet. Even if it not likely to change, it is still possible that it will change in the future.

Usage

As an example, you could create a command that prints "Hello from castor" by creating a file castor.php with the following content:

<?php

namespace greetings;

use Castor\Attribute\AsTask;
use function Castor\run;

#[AsTask]
function hello(): void
{
    run('echo "Hello from castor"');
}

Then you can run the command with castor greetings:hello:

$ castor greetings:hello
Hello from castor

Then, you can go wild and create more complex commands:

#[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.')
}

If you want to read more about usage, you can read the basic usage documentation, or browse the examples directory.

Installation

Note
Castor requires PHP >= 8.1 to run.

You can download the latest release of Castor as a phar file from the releases page.

You can also download the latest version by browsing the build page and selecting the last build.

We provide different phar for Unix/Windows architectures to offer lighter phar files. Download the correct one and make it available in your shell:

Example for Linux:

curl "https://github.com/jolicode/castor/releases/latest/download/castor.linux-amd64.phar" -Lso $HOME/.local/bin/castor && chmod u+x $HOME/.local/bin/castor

There are other ways to install Castor, please refer to the documentation.

Further documentation

Discover more by reading the docs:

Questions and answers

How is Castor different from raw Symfony Console usage?

Castor is a task runner, so it's primary goal is to run simple tasks to simplify the project development. Usually, it is used to run Docker commands, database migrations, cache clearing, etc.

Usually, tasks are very small, like 1 or 2 lines of code. So you probably don't want to waste your project with ops command that are not strictly related to the business.

Why "Castor"?

Castor means "beaver" in french. It's an animal building stuff. And this is what this tool does: it helps you build stuff 😁

More Repositories

1

JoliNotif

💻 Send notifications to your desktop directly from your PHP script
PHP
1,324
star
2

JoliCi

✅ JoliCi - Run your TravisCi builds locally
PHP
657
star
3

elasticsearch-cheatsheet

🔎 Elasticsearch is awesome, here is a cheatsheet for it.
HTML
339
star
4

docker-starter

🏗️ A skeleton to start a new web project with PHP, Docker and Castor
PHP
335
star
5

JoliTypo

🔤 Microtypography fixer for the web
PHP
318
star
6

elastically

🔍 JoliCode's Elastica wrapper to bootstrap Elasticsearch PHP integrations
PHP
241
star
7

slack-php-api

#️⃣ PHP Slack Client based on the official OpenAPI specification
PHP
219
star
8

emoji-search

😄 Emoji synonyms to build your own emoji-capable search engine (elasticsearch, solr, OpenSearch)
PHP
215
star
9

secret-santa

🎅 The code behind Secret Santa, the holiday bot for Slack / Discord / Webex
PHP
213
star
10

GifExceptionBundle

😛 The GhostBuster of your exception page!
PHP
205
star
11

php-ar-drone

🚁 Port of node-ar-drone which allows user to control a Parrot AR Drone over PHP
PHP
204
star
12

composer-cheatsheet

📋 Everything you have to know about composer.json in one page.
HTML
146
star
13

automapper

🚀 Very FAST 🚀 PHP AutoMapper with on the fly code generation
PHP
130
star
14

generator-joli-symfony

👨 Yeoman Generator for Symfony2 projects with sensible defaults and frontend tools.
JavaScript
100
star
15

asynit

🌠 Asynchronous HTTP Request Testing Library for API or more...
PHP
77
star
16

Alloy-PullToRefresh

Pull to refresh widget for Titanium Alloy applications.
JavaScript
55
star
17

Badass-Pageflow

📲 A simple Alloy "pageflow" widget, which allows to open windows w/ styles back buttons. Features a complete a simple API.
JavaScript
44
star
18

ffi-uuid

Binding of the libuuid library with PHP thanks to PHP/FFI.
PHP
39
star
19

docker-images

🚢 Basic images for different usages
Makefile
33
star
20

pomdok

🍏 Simple wrapper to Symfony Go Binary for multi-app
Go
27
star
21

qotd

PHP
25
star
22

codingstyle

💅 JoliCode's base dotfile for PHP / JS projects
PHP
24
star
23

chef-cookbook-php

A Chef Cookbook for PHP, does not depend on apache and will not use or install pear like the official one.
Ruby
23
star
24

harvest-php-api

🌾 A Harvest API PHP Client
PHP
22
star
25

starfleet

🚀 Share your conferences activity to your buddies
PHP
20
star
26

php7-checker

☑️ PHP7 checker
PHP
18
star
27

Harvest-Forecast-tools

📅 Some useful additions to https://www.getharvest.com/ and https://www.getharvest.com/forecast
JavaScript
16
star
28

symfony-jwt-article

PHP
16
star
29

seo-override

🏁 Override your SEO related markup on the fly
PHP
14
star
30

harvest-openapi-generator

🔮 Transforms Harvest API HTML documentation pages into a valid Swagger / OpenAPI 3.0 specification
PHP
13
star
31

JoliTypoBundle

🔤 Integration of JoliTypo for Symfony2 (deprecated, use the provided bridge instead)
PHP
13
star
32

forecast-tools

⛅ Tools to get the most out of Harvest Forecast. Get Slack notifications, schedule Slack stand-up meetings, share public Forecasts, and more
PHP
13
star
33

JoliMarkdown

✍ A syntax fixer for markdown content
PHP
12
star
34

Symfony2BackboneDemo

JavaScript
12
star
35

symfony-security-article

PHP
12
star
36

php-os-helper

Provides helpers to detect OS of the machine where PHP is running.
PHP
12
star
37

monologue

A bot to manage "monologue" rule in a Slack Channel
PHP
10
star
38

ApacheTikaBundle

📁 Symfony Bundle for https://github.com/vaites/php-apache-tika
PHP
10
star
39

elasticsearch-php-benchmark

Benchmark of some PHP Clients for Elasticsearch
PHP
10
star
40

Reepo

Abstraction of repository providers (github, gitlab, redmine, ...)
PHP
9
star
41

symfony2-eventdispatcher-extension

Symfony2 Event Dispatcher as PHP extension written with Zephir
C
9
star
42

JoliToken

🔍 Elasticsearch plugin to visualize field tokens as analyzed by Lucene
JavaScript
9
star
43

isready-symfony2

Symfony2 production checklist for http://isready.org
7
star
44

best-bundle-conf

Symfony Live Paris 2013 talk about the best and unknown Symfony2 Bundles (in French)
JavaScript
7
star
45

JoliSnap

JavaScript
6
star
46

100-async-0-callback-conf

✨ https://jolicode.github.io/100-async-0-callback-conf/#/0
JavaScript
6
star
47

webhook-demo

PHP
6
star
48

unicode-conf

😋 Unicode, PHP et la sécurité
JavaScript
5
star
49

forecast-php-api

⛅ A Forecastapp API PHP Client
PHP
5
star
50

GouvCamp-mobile

Mobile app for the GouvCamp 2012
JavaScript
5
star
51

SecurityBundle-avec-de-l-aspirine

JavaScript
4
star
52

react-et-symfony-conf

💍 Marier React et Symfony
HTML
4
star
53

value-object-conf

💻 Slides from Forum PHP 2015 talk about Value Object
HTML
4
star
54

everything-titanium-using-the-cli-talk

Slides of the TiConf Amsterdam 2014 about using CLI tools in the Titanium world.
JavaScript
4
star
55

symfony-htmx-demo

Small Symfony project with HTMX and AssetMapper
PHP
3
star
56

lab-webgl-home

Jolicode website homepage in 3D
JavaScript
3
star
57

jolitypo-website

✍️ Sample app to testdrive JoliTypo
Twig
3
star
58

tabto

➡️ Auto-tabulation for your inputs. Tiny helper that focus user on the next field when a field reach maxLength.
JavaScript
3
star
59

php-the-wrong-way-conf

⛔ PHP The Wrong Way
PHP
3
star
60

docker-drupal-meetup-conf

CSS
2
star
61

php7cc-conf

💻 A la recherche d'incompatibilités avec PHP 7, Apéro PHP conf by @pyrech
JavaScript
2
star
62

http-cache-conf

JavaScript
2
star
63

smile-php

🙂
PHP
2
star
64

fosuserbundle-conf

💻 Do Not Use FOSUserBundle conference
JavaScript
2
star
65

zephir-conf

Introduction about Zephir in french
JavaScript
2
star
66

typography-conf

Sud Web 2013 - Damien ALEXANDRE slides about space and french typography
JavaScript
1
star
67

drupal-rache-conf

Drupal Meetup Paris mai 2013 – Bastien Jaillot slides "Drupal au secours de la méthode R.A.C.H.E"
JavaScript
1
star
68

Badass-Pageflow-Demo

Demo App for the Badass-Pageflow alloy widget
JavaScript
1
star
69

phptour-2014--dette-technique--conf

Conférence "Prévenez la dette technique de vos projets" au PHP Tour Lyon 2014
CSS
1
star
70

phptour2014-drink

1
star
71

phptour2014-burger

PHP
1
star
72

ca-marche-chez-moi

Sources des slides de la conférence "Chez moi ça marche" - PHP Tour 2012
CSS
1
star
73

sud-web--2014--dette-technique

Conférence sur la dette technique à SudWeb 2014
CSS
1
star