microparts / microservice-starter-php
Default template for quick writing microservice.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
Requires
- php: >=7.2
- ext-json: *
- ext-pdo: *
- ext-swoole: *
- igniphp/framework: ^2.0.0
- microparts/configuration-php: ^2.0
- microparts/igni-support-php: dev-master
- roquie/database: dev-master#a118eb8cfe681002bbe76e8c54ba57b8afaa800d
Requires (Dev)
- eaglewu/swoole-ide-helper: dev-master
- fzaninotto/faker: ^1.8
- phpunit/phpunit: ^7.5
- roave/security-advisories: dev-master
- symfony/var-dumper: ^4.1
This package is auto-updated.
Last update: 2020-08-13 14:59:52 UTC
README
This starter designed for quick start of microservice development.
Available from the box:
- high performance
- web server (swoole extension required)
- supports set of corporate standards like as: Configuration package, Pagination, ServiceInfo, Healthcheck, i18n, Logging and so on.
- optimized docker image with latest PHP version configured to maximum performance
- instrument to automatically migration and database seeding at app starts (configurable, enabled by default)
- single error handler
- configured PHPUnit for writing Unit-tests
- configured docker-compose
Usage
composer create-project microparts/microservice-starter-php app_name
Run
php index.php
# or
docker-compose build
docker-compose up -d
Hello
Default hello world.
$ curl http://0.0.0.0:8080/example | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16 100 16 0 0 616 0 --:--:-- --:--:-- --:--:-- 640 { "punks": "hoy!" }
Default service info:
$ curl http://0.0.0.0:8080/ | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 227 100 227 0 0 31642 0 --:--:-- --:--:-- --:--:-- 32428 { "service": { "name": "Microservice starter, PHP", "about": "Default template for quick writing microservice.", "version": "0.1.0", "docs": null, "contacts": "ask@teamc.io", "copyright": "teamc.io © 2019" }, "message": "hello stranger!" }
Makefile usage
- Replace docker-image name in the
Makefile
file - Build docker-image
make image
- Run docker image
make run
- Or run docker image with custom stage, for example I use
local
stage:
make STAGE=local run
Notices
- For enabling connection to the PostgreSQL database uncomment the line in
./bootstrap.php
file. - Information about this service located at
./configuration/defaults/service.yaml
.
Tests
vendor/bin/phpunit
License
GNU GPL v3