Is there any PHP open source framework that supports both Cli and http requests?

simplify the question
what PHP framework is available also supports the following functions:

  1. supports http access
  2. supports socket communication
  3. the data obtained by the controller (logic processing part) are data types parsed by the framework (such as Array and json), because get and post cannot be used in the controller (logic processing) if they meet the conditions of 1 and 2, unless the framework parses the received data to get. | post (it seems better to parse to the array and hand it over to the business layer)

-I am the dividing line. The following is the content of the previous question-

the current company"s PHP project is natively developed.

  1. http request : parse the uri and request parameters in the entry file (index.php), and load the corresponding class processing through the class reflection .
  2. Cli method : slightly adjust the Cli method to change the entry file (index.php) to a cli listening script, parse the passed json data, and then call the corresponding business logic through class reflection.

but most of the time it feels like a new wheel. Is there a mature framework that is as convenient as the current one to implement a business logic , and also supports http, cli and other processing?

Jul.04,2022

I don't know if you mean executing an one-time script on the command line by Cli. Thinkphp YII laravel supports both Http and console.

look at the description like Cli launches a HttpServer, yii2-swoole and think-swoole supports such functions


this framework https://github.com/lizhichao/one
supports fpm operation
supports swoole collaboration environment

support cli access controller

curl http://xxx.com/abc
cli access: php shell.php / get/abc

Menu