Skip to content

Remote execution

Castor allows you to run any php package without installing it on your machine or withing your dependencies. This is done by using the castor execute command

As an example, let's say you want to run the friendsofphp/php-cs-fixer package to fix your code style. You can do this by running the following command:

castor execute friendsofphp/php-cs-fixer fix

This will download the package and its dependencies, and then run the first binary command it finds in the package. In this case, it will run the php-cs-fixer binary command with the fix argument.

All options after the package name will be passed to the binary command.

Specific binary of package

If you want to run a specific binary command of a package, you can do this by adding the binary name after the package name separated with the @ character :

castor execute friendsofphp/php-cs-fixer@php-cs-fixer fix

Using a specific version of a package

If you want to run a specific version of a package, you can do this by adding the version number after the package name separated with the : character :

castor execute friendsofphp/php-cs-fixer:3.0 fix

Extra dependencies

You may need several packages to run a command. For example, if you want to run phpstan with extensions, you can do this by running the following command:

castor execute --deps phpstan/phpstan-symfony phpstan/phpstan