sunrise / awesome-skeleton
Awesome Skeleton for modern development on PHP 7.4+ (incl. PHP 8)
Installs: 177
Dependents: 0
Suggesters: 0
Security: 0
Stars: 89
Watchers: 8
Forks: 3
Open Issues: 2
Type:project
Requires
- php: ^7.4|^8.0
- arus/doctrine-bridge: ^1.18
- arus/http-response-kit: ^1.4
- arus/monolog-telegram-handler: ^2.1
- doctrine/migrations: ^2.2
- doctrine/orm: ^2.8
- justinrainbow/json-schema: ^5.2
- middlewares/payload: ^3.0
- middlewares/response-time: ^2.0
- monolog/monolog: ^2.2
- php-di/php-di: ^6.3
- spiral/roadrunner: ^1.9
- sunrise/http-factory: ^1.1
- sunrise/http-header-kit: ^1.1
- sunrise/http-router: ^2.6
- sunrise/http-router-openapi: ^1.9
- symfony/cache: ^5.0
- symfony/console: ^5.0
- symfony/dotenv: ^5.0
- symfony/validator: ^5.0
Requires (Dev)
- phpbench/phpbench: ^1.0.0-alpha4
- phpunit/phpunit: ^9.5
- sunrise/coding-standard: 1.0.0
This package is auto-updated.
Last update: 2024-11-08 00:23:18 UTC
README
Contains quality tested packages, thoughtful structure and everything you need to develop microservices.
Installation
composer create-project 'sunrise/awesome-skeleton:^3.0' app
Cooking
Set up your database connection:
cp .env.example .env && nano .env
Execute a migration:
php bin/app migrations:migrate --service 'master' --no-interaction
Run CLI
incl.: Doctrine DBAL, Doctrine ORM, Doctrine Migrations.
php bin/app
Run via PHP
listen 0.0.0.0:3000
composer serve
Run via RoadRunner
listen 0.0.0.0:3000
Set up your server:
cp .rr.yml.example .rr.yml && nano .rr.yml
Run the server:
rr -dv serve
Run via Swoole
Coming soon...
Run tests
composer test
Run benchmarks
composer bench
Run routes through cURL
you may need to change the server address...
Home (index)
curl -X 'GET' 'http://127.0.0.1:3000/'
OpenAPI document
curl -X 'GET' 'http://127.0.0.1:3000/openapi'
Create an entry (example bundle)
curl -X 'POST' -H 'Content-Type: application/json' -d '{"name": "foo", "slug": "foo"}' 'http://127.0.0.1:3000/api/v1/entry'
Update an existing entry (example bundle)
you need to set an existing ID.
curl -X 'PATCH' -H 'Content-Type: application/json' -d '{"name": "foo", "slug": "foo"}' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
Delete an existing entry (example bundle)
you need to set an existing ID.
curl -X 'DELETE' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
Read an existing entry (example bundle)
you need to set an existing ID.
curl -X 'GET' 'http://127.0.0.1:3000/api/v1/entry/b06fd41d-d131-4bb9-a472-eb583369437c'
List of entries (example bundle)
curl -X 'GET' 'http://127.0.0.1:3000/api/v1/entry'
Useful commands
Deploy
bash bin/deploy
Down
bash bin/down 'Reason...'
Up
bash bin/up
Generate Systemd unit for RoadRunner
php bin/app app:roadrunner:generate-systemd-unit > app.service
Generate OpenApi document
php bin/app app:openapi:generate-document > openapi.json
Used stack
see composer.json
- https://github.com/PHP-DI/PHP-DI
- https://github.com/Seldaek/monolog
- https://github.com/sunrise-php/http-router
- https://github.com/doctrine/orm
- https://github.com/doctrine/migrations
- https://github.com/symfony/console
- https://github.com/symfony/validator
- https://github.com/justinrainbow/json-schema
Used technology
RoadRunner
OpenApi (Swagger) specification
- https://swagger.io/docs/specification/about/
- https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md
Json Schema specification
It may be useful to you
Awesome middlewares for your application
with ❤️ for you