PHP extension implementation simple MVC framework almost all WEB projects in the company's projects use the codeigniter framework. in order to reduce the time for a single PHP execution request and reduce the server processing response time,
At the same time, the total number of responses per minute is increased. the purpose of developing this extension is to improve the basic general functions of the Router, Template, Config, Controller, and other frameworks from the underlying layer,
PHP scripts only process business logic and give full play to their respective advantages.
Considering the cost of project migration, the extended MVC is also designed based on the CI prototype, and many functions are not commonly used.
Supported versions: PHP5.3 +
The following two results are provided for testing the number of concurrent requests on the same website within one minute from 10 to 100.
Data comparison: (test tool curl loader) type 1-minute total number of requests succeeded times failed times average response time average number of requests per second original CI framework 17706 15772 1844 137 ms 267 times expansion 57599 46654 10881 6 ms 866 times
Original PHP Ci framework:
Extended MVC:
The extended implementation framework improves the response speed by about 10 times, the total number of requests increases by about 3 times, and the failure rate increases by about 8%.
Use Case: Nginx. conf configuration single Portal (same as Ci single portal, no change), for example:
Server {listen 80; server_name test.cn; index. php; root/usr/local/wwwroot/test/public; location/{rewrite ^/$/index. php last; # prevent some folders from being directly accessed by rewrite ^ /(?! Index \. php | robots \. txt | images | js | css | styles | static) (. *) $/index. php/$1 last;} location ~ \. Php {fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params ;}}
Entry file index. php:
$ Application_folder = 'application'; $ dir_path = './'; if (strpos (_ FILE __,'\')! = False) {$ dir_path = substr (_ FILE __, 0, strrpos (_ FILE __,'\')). '/';} elseif (strpos (_ FILE __,'/')! = False) {$ dir_path = substr (_ FILE __, 0, strrpos (_ FILE __,'/')). '/';} define ('basepath', str_replace ("\", "/", realpath ($ dir_path. '.. /'). '/'); define ('apppath', realpath (BASEPATH. $ application_folder ). '/'); $ framework = new wk_framework (); $ framework-> loadView (); $ framework-> setTemplateDir (APPPATH. '.. /public/template/'); $ framework-> setCompileDir (APPPATH. '.. /public/data/complie/'); $ framework-> setApplicationPath (APPPATH); // release, test, development, the configuration file path is automatically switched based on the conditions. // The/application/config/ENVIRONMENT/config parameter is not found. The/application/config $ framework-> setEnvironment ('release') parameter is not found '); require_once (APPPATH. 'core/WK_Controller.php '); $ framework-> initialize (); $ framework-> captureRouter ();
For more information about how to install the extension, go
Go to project URL: Enter