bednic / api-skeleton
SlimPHP + Doctrine2 ORM + PHP DI + JSON API skeleton for building REST API's.
Requires
- php: ^7.4
- bednic/json-api: ^6.2
- doctrine/migrations: ^3.0
- doctrine/orm: ^2.7
- monolog/monolog: ^2.1
- php-di/php-di: ^6.3
- roave/doctrine-simplecache: ^2.3
- slim/http: ^1.0
- slim/psr7: ^1.2
- slim/slim: ^4.5
- symfony/dotenv: ^5.1
Requires (Dev)
- ext-xdebug: *
- php-console/php-console: ^3.1
- phpunit/phpunit: ^8.1
- squizlabs/php_codesniffer: ^3.4
Suggests
- ext-apcu: For caching JSON API metadata end DI definition cache on production
This package is auto-updated.
Last update: 2024-11-29 05:51:25 UTC
README
This skeleton provides setup for JSON API. It's based on Slim 4, Doctrine 2, PHP DI and JSON API library.
Install
$ composer create-project bednic/api-skeleton <path> "0.1.*"
Own DI configuration file
If you want own DI configuration or overload current,
then you just add file like di-config.local.php
to /config folder.
It will rewrite default DI configuration.
Own ENV
You can override environment by own .env
file. Just make own file, e.g. .env.local.
Structure
├───/app
│ ├───/Controller
│ ├───/Factory
│ ├───/Migration
│ ├───/Model
│ │ ├───/Entity
│ │ └───/Repository
│ └───/Service
│
├───/cache
├───/config
├───/log
├───/public
├───/tmp
└───/vendor
Docker
You can start developing via Docker
docker build -t . && docker run -p 80:80 -v /path/to/project:/var/www --name api
Docker Compose
docker-composer up -d
There is a couple of thinks you have to do, if you want skeleton works from start.
docker exec -it api vendor/bin/doctrine orm:generate:proxies docker exec -it api vendor/bin/doctrine-migrations migrate
api
is the name of api container. The migration ask of confirmation, so say yes.
After these steps you should have working API, just hit http://localhost. You should see generated OAS schema.