kadirov/api-starter-kit

Installs: 3 666

Dependents: 0

Suggesters: 0

Security: 0

Stars: 43

Watchers: 2

Forks: 15

Open Issues: 5

Type:project


README

Starter kit for API with Symfony Skeleton, Doctrine, Maker Bundle, Migrations Bundle, Api-Platform and Lexik JWT-auth.

Kit has also already created User entity with all crud routes

Kit has 3 docker containers: php, nginx and db

poster

Installation

Download the project

composer create-project kadirov/api-starter-kit --ignore-platform-reqs --no-scripts

Go to the project directory

cd api-starter-kit

Run docker containers

docker compose up -d

Install composer scripts

docker compose exec php composer install

To install project run command

docker compose exec php bin/console ask:install

Done! You can open http://localhost:8507/api via browser. By the way, you can change this port by changing DOCKER_NGINX_PORT variable in .env file.

Docker

For enter to php container run

docker compose exec php bash

For enter to db container run

docker compose exec db bash

For enter to nginx container run

docker compose exec nginx bash

You can change containers prefix by changing DOCKER_PROJECT_NAME variable in .env file.

Also, you can change public ports of nginx and mysql by changing DOCKER_NGINX_PORT and DOCKER_DATABASE_PORT

Database allows connections only from localhost. Because of this when you use the project on production and want to connect to database from your computer you should connect via ssh bridge.

Backup

For automatic backups use:

docker compose --profile backup up -d

In your .gitlab-ci.yml, the backup profile is configured to run on the production server and perform backups daily at 00:00 UTC.

To run manual backup:

docker compose exec backup /usr/local/bin/backup.sh

Cron

You can use docker/php/cron-file for cron jobs. After you must re-build php container by running command:
docker compose up -d --build

Swagger

You can change project name and description on swagger by editing file config/packages/api_platform.yaml