A lightweight PHP framework
A simple PHP "framework"? Or it can be said to be an application template.
ORM Use Eloquent ORM, routes use FastRoute
Most of the interface designs refer to Laravel, which adopts facade mode, singleton mode, control inversion (IoC), and dependency injection (DI), and some also use other design modes.
Integrated IoC container, PSR-11 compatible
Supports integration with ReactJS, and other front-end frameworks are also OK, but I only wrote ReactJS configuration.
Middleware that supports PSR-15 standard.
Encapsulated requests and responses, designed according to the PSR-7 standard, but added Laravel-like interfaces.
Supports setting dependency injection, routing and middleware through annotation
It supports Aop, but since there is no inheritance agent method, the scope of support for entry is limited. Currently, it supports store entry and controller entry. At the same time, corresponding methods have been added to the container to provide entry functions.
The reason why the inheritance proxy is not used is that PHP does not have a Proxy reflection interface similar to that in Java. PHP inheritance proxy needs to use eval or require to dynamically declare the class, which has a security risk.
Provide a simple observer implementation, although generally useless.
Use APCu to cache annotations
It provides an implementation of a task queue, similar to a coroutine, which can be proactively given up, but since PHP does not have a multi-threading mechanism, it cannot achieve non-blocking.
Since you are writing this kind of project for the first time, there will be many design flaws and vulnerabilities. It is not recommended to use the project in any production environment, just for learning. If you have better suggestions or find shortcomings, please feel free to feedback.
The purpose of writing this project is to prepare for the next blog project, because there is no framework to use, so this project 2333 has been created.
git clone https://github.com/syfxlin/xkphp.gitcomposer install In some cases, laminas/laminas-httphandlerrunner may not be installed normally. At this time, you need to install laminas/laminas-diactoros first.
yarnphp -r " echo base64_encode(openssl_random_pseudo_bytes(32)); "composer migration:upphp -S 0.0.0.0:8000 -t publicNone yet
XK-PHP is written and maintained with the help of Otstar Lin and the following contributors.
Otstar Lin -Personal Website · Blog · Github
Open source under the Apache License 2.0 license.