I want to program a little CLI script in PHP, basically with two possible arguments to do two different things. Very easy. But I would like to do in an elegant way.
I was wondering if it exists some PHP micro-framework functionaly in CLI mode (note that I say micro-framework and not framework). I want to use PHP because I'll include some PHP already programmed classes.
I have found CLImax, that is an specific CLI micro-framework and seems good, but it lacks a good documentation.
Do you know any place where I can found a good CLImax documentation (I haven't found anything, but its source code poorly documented)?
Or maybe do you know another option? Alloy seems as well a lightweight PHP framework, and has CLI "mode", but I don't know if it's too generic, as it's as well for web servers. Have you used it?
PHP's Command Line Interface (CLI) allows you to execute PHP scripts when logged in to your server through SSH. ServerPilot installs multiple versions of PHP on your server so there are multiple PHP executables available to run.
Swoft is a PHP high performance microservice coroutine framework. It has been published for many years and has become the best choice for php. It can be like Go, built-in coroutine web server and common coroutine client and is resident in memory, independent of traditional PHP-FPM.
A full-stack PHP framework delivered as a C-extension. Its innovative architecture makes Phalcon the fastest PHP framework ever built! Developers do not need to know C to use Phalcon. Its functionality is exposed as PHP classes and interfaces under the Phalcon namespace, ready to be used.
Check out the Symfony Console component. Here's an introduction to using it. It may take a little bit of work to get it to function with an older version of PHP (without namespaces), and you need a couple other components from Symfony, but I've used it quite successfully.
I've found this one: php-cli-tools
It's definitely micro and brings everything you'd have with sh or windows batch.
It doesn't have great documentation from what I can see, but Cilex describes itself as:-
"a lightweight framework for creating PHP CLI scripts inspired by Silex"
Might be worth a look, I am thinking of using it myself to replace the bash deployment scripts I have written.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With