lukekortunov / micra
Skeleton for incredibly simple PHP apps with Routing, DI and Dotenv
1.2.0
2023-08-03 15:10 UTC
Requires
- php: >=8.1
- laminas/laminas-diactoros: ^2.24
- laminas/laminas-httphandlerrunner: ^2.5
- lcobucci/jwt: ^4.3
- league/container: ^4.2
- league/route: ^5.1
- lukekortunov/micra-contracts: ^1.2
- symfony/dotenv: ^6.2
Requires (Dev)
- phpunit/phpunit: ^10.0
- symfony/var-dumper: ^6.2
README
## Run application You can manually run app.php by any server you want, but I've packed Makefile to make life easier. Just execute `make serve` and it will start PHP server on port `8008`. ## HTTP Middlewares ### Authorization middleware To enable JWT authorization you need to generate RSA keys by executing `make generate-rsa-keys` and uncomment code `// $router->middleware(new \App\Middleware\AuthenticationMiddleware);` in `src/app.php`. It will add JWT middleware to your request-response flow, so only valid JWTs in headers will be accepted. Note: To generate JWT token you can use [jwt.io](jwt.io). You need to use RS512 algorithm and paste your public and private keys to the corresponding fields.