Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP cli micro-framework?

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?

like image 773
Waiting for Dev... Avatar asked Aug 25 '11 20:08

Waiting for Dev...


People also ask

What is PHP CLI command?

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.

Which PHP framework is best for Microservices?

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.

What is the fastest PHP framework?

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.


3 Answers

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.

like image 152
Devin Humbert Avatar answered Sep 20 '22 07:09

Devin Humbert


I've found this one: php-cli-tools

It's definitely micro and brings everything you'd have with sh or windows batch.

like image 23
Leonel Avatar answered Sep 23 '22 07:09

Leonel


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.

like image 27
rgvcorley Avatar answered Sep 23 '22 07:09

rgvcorley