bednic/api-skeleton

SlimPHP + Doctrine2 ORM + PHP DI + JSON API skeleton for building REST API's.

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:project

0.1.1 2020-10-30 14:46 UTC

This package is auto-updated.

Last update: 2024-03-29 03:50:33 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.

Issues