Run Composer packages,
effortlessly.

The entire PHP ecosystem, always at your fingertips

Get cpx now Check out the features
see how easy it is to use!
|

Thousands of tools in the palm of your hand

Run any Composer package's commands on-the-fly

cpx lets you invoke a command from any Composer package with ease.

Just run it.
Just run cpx vendor/package to invoke the command from a package. If a package has more than one command, pass through the command name like cpx vendor/package <command>
If you need to pass further arguments or options to the command, append them on the end. It's just intuitive.
No installation.
No need to install the dependency into your package or into your global Composer install. cpx handles package installations and updates behind-the-scenes so you don't have to worry about it.
No dependency conflicts.
Because cpx itself has no dependencies, and it keeps any packages you run separate from the rest of your code, there's no chance for conflicts when running different commands.
Always up-to-date.
cpx periodically checks if there's an update to packages you run, so you always get the latest and greatest without needing to worry about updating it manually.
|

Don't worry about different tools for different projects

Normalize your workflow

When you switch between lots of projects, you might find they don't always use the same tooling, so the commands you run are different for each one.

cpx provides commands that will detect the tools the current project is using, and use the correct one for you.

cpx test
will run the project's test framework, whether it's PHPUnit, Pest, Codeception or something else.
cpx check
(or cpx analyze ) will run static analysis on your project, whether that's PHPStan, Psalm, Phan or something else.
cpx format
(or cpx fmt ) will format your project's code according to the defined styles, using a tool like PHP-CS-Fixer, Laravel Pint, PHPCBF or something else.
|

Helping you write code fast

Superpowers for running PHP

cpx gives you multiple ways to run PHP code quickly, perfect for running scratch files or quickly running code in your project.

  • cpx exec <file.php> will run a plain PHP file.
  • cpx exec -r <raw php code> will execute the given PHP code.
  • cpx tinker will open an interactive REPL in the terminal for your project.

But what is it you get from this over just using php or php -r or psysh directly?

You get all this:
Automatic project autoloaders
Any Composer autoloaders in the directory are included automatically, so you can access and use your project code effortlessly.
Dynamic packages
Use composer_require('vendor/package') in your scratch file to dynamically include packages for testing purposes.
Class aliasing
If you use a class without referencing its full namespace, cpx will figure it out for you, no need for "use" statements.
Laravel bootstrapping
When in a Laravel project directory, the Laravel app will be bootstrapped so you can use any services just like you're writing your app.

Made with for the PHP community by Liam Hammett