Download the PHP package peroxide/api-skeleton without Composer
On this page you can find all versions of the php package peroxide/api-skeleton. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package api-skeleton
Peroxide: API-Skeleton
API skeleton: Built on top of Slim and OpenSwoole, our API skeleton is designed for microservices projects, prioritizing both performance and simplicity.
How to install
Using composer to install the skeleton:
Or
Please note: Running Composer without the --ignore-platform-reqs flag may result in errors if you haven't installed the OpenSwoole PHP extension.
Setup
Create your local .env file
To start the local server, you'll need Docker and Compose up and running under your system user. No fancy commands needed, just make sure Docker and Compose are good to go.
To run as docker compose
Testing
Health check route
Create your code
Router
Routes can be declared on config/routes.php, you are free to compose your route files like the example:
For more details read Slim 4 Routes resolution page:
https://www.slimframework.com/docs/v4/objects/routing.html
Obs: All routes are managed by methods specified in the router configuration, which utilize callable classes with the '__invoke' method, simple methods, or callable functions.
Our Container
We've developed our straightforward container component, named peroxide/container. With it, injecting dependencies into your classes becomes a breeze: Controllers, UseCases, Commands, DTOs, and Domains in a declarative manner. For further insights, check out the documentation:
https://github.com/Peroxide-PHP/peroxide-container
Container resolution follows the PSR-11 standard, offering the flexibility to adjust the container mechanism according to your preferences, you can even swap it out entirely if needed.
Migrations
We're offering a migration component called Phinx, which is a standalone library for implementing migrations without being tied to any specific frameworks.
Here how to use it:
Example of migration class:
For more details about phinx read: https://book.cakephp.org/phinx/0/en/migrations.html
Seeders
Session under construction...
Quality tools
Code sniffer
CS Fixer
Tests with PHPUnit
PHPStan
Mess Detector
Performance benchmarks
Coming soon...
Attention!
This skeleton server runs on the OpenSwoole runtime, enabling executions through coroutines.
It's crucial to be mindful of socket communications, using PDO with Postgres can block the event loop, while MySQL with PDO is compatible (swoole handles communication for you).
For Postgres, consider utilizing the Postgres Client instead. Be diligent in vetting any other communication methods before implementation to preempt any unforeseen issues down the line.
For more information about blocking event loop please check the documents: https://openswoole.com/
Suggestions or PR's
Feel free to fork the project and submit a pull request to the develop branch. We welcome any suggestions or collaborations you have to offer!
All versions of api-skeleton with dependencies
slim/slim Version ^4.13
openswoole/core Version 22.1.4
peroxide/container Version ^1.1
robmorgan/phinx Version ^0.16.0