All Projects → juanwilde → sf5-api-platform-boilerplate

juanwilde / sf5-api-platform-boilerplate

Licence: other
Boilerplate with Docker, Symfony 5, API Platform and Docker

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
Makefile
30231 projects
Dockerfile
14818 projects
TSQL
950 projects

Symfony 5 + API Platform + Docker boilerplate

What is this?

This is a boilerplate project which includes Symfony 5.0, API Platform and a Docker configuration.

It contains all the features needed to start building an API:

IMPORTANT: to run functional tests access the database container and create a database called database_test or create your own configuration. doctrine/doctrine-fixtures-bundle and liip/test-fixtures-bundle are included.

Folder structure

src
├───Api/
│   ├───Action/ <- Custom endpoints
│   ├───Listener/ <- API Platform listeners
├───DataFixtures/ <- Functional tests fake data
├───Entity/ <- Doctrine entities
├───Exception/ <- Domain exceptions
├───Migrations/ <- First migration (new migrations will be added here)
├───Repository/ <- Base repository and your repositories extending from it
├───Security/
│   ├───Authorization/ <- Place for your Voters
│   ├───Core/ <- UserProvider location
│   ├───Validator/ <- Your custom validators (see services.yml to check how they work
├───Service/ <- Your app services go here
├───Templating/ <- Reference to templates used by the MailerService
├───templates/ <- Twig templates for emails
├───tests/ <- Functional and unit tests

Usage

  • make build to build the docker environment
  • make run to spin up containers
  • make prepare to install dependencies and run migrations
  • make generate-ssh-keys to generate JWT certificates
  • Navigate to http://localhost:500/api/v1/docs to check the Open API v3 documentation
  • make restart to stop and start containers
  • make ssh-be to access the PHP container bash
  • make be-logs to tail dev logs
  • make code-style to run PHP-CS-FIXER on src and tests
  • make tests to run the test suite

IMPORTANT: depending on if you are using MacOS or Linux check the configuration for Xdebug in your docker-compose.yml file and choose the correct one for your needs

Stack:

  • NGINX 1.19 container
  • PHP 7.4 FPM container
  • MySQL 8.0 container + volume

Contributing

Feel free to clone, fork or PR this repo

License

This bundle is under the MIT license. For the whole copyright, see the LICENSE file distributed with this source code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].