Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

DavidGarciaCat/sf4-rest

Repository files navigation

Symfony 4.0 RESTful API

Please note this project was built just for testing and educational purposes.

Prerequisites

Download and install Docker: https://www.docker.com/community-edition

Download and install Git (optional): https://git-scm.com/downloads

Docker schema

This project provides by default the following Docker Containers:

  • Nginx on port 8000
  • PHP v7.2 FPM on port 9000
  • MySQL on port 3306 with:
    • root user and password password
    • symfony user, symfony password and symfony database
  • Redis on port 6379
  • Memcached on port 11211

Download and install

Just download and extract this repository, or clone it through the following command:

git clone [email protected]:DavidGarciaCat/sf4-rest.git

Go to the project's folder:

cd sf4-rest

And create your .env file based on .env.dist:

cp .env.dist .env

Useful Docker commands

Start containers on the foreground (you will see a stream of logs for every container running):

docker-compose up

Start containers in the background:

docker-compose up -d

Stop containers:

docker-compose stop

List containers:

docker-compose ps

Execute command inside of container:

docker exec [FLAGS] CONTAINER_NAME COMMAND

...where COMMAND is whatever you want to run. Examples:

Description Command
Shell into the PHP Container docker exec -it sf4-rest-php bash
Install composer dependencies docker exec sf4-rest-php composer install -o

Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container):

docker system prune

To additionally remove any stopped containers and all unused images (not just dangling images), add the -a flag to the command:

docker system prune -a

How to access to the API endpoints

Just browse your Local Host targeting port 8000: http:https://localhost:8000/

Thanks

This repository has been created just for testing and educational purposes, based on these 2 examples: