The purpose of this repository is to have a basic example of api platform & Symfony
1.Create the .env file for docker:
cp .infra/docker/dist.env .infra/docker/.env2.Modify the environment variables.
- The file is ready to start working with an index in the root of the project:
APP_DIR=../..
- Using the 80 port:
HTTP_PORT=80
- And 3306 for database:
DB_PORT=3306
Important!!! If the ports are being used change them or the compose-up will exit showing an error
3.Run Docker
cd .infra/docker
docker-compose up --build -d4.Copy the file .infra/docker/docker-exec to the root of your project and make it executable:
cp .infra/docker/docker-exec docker-exec
chmod a+x docker-exec5.Exec composer install
./docker-exec composer install6.Create the database schema
./docker-exec php bin/console doctrine:schema:update --force7.Load the fixtures
./docker-exec php bin/console doctrine:fixtures:load -n8.Now you should be able to access the project writing in the browser:
http://localhost:80Important!!! Change 80 for the port you have set in HTTP_PORT in .env
Extra: You can change your /etc/hosts:
127.0.0.1 apiplatform.test9.Access to the url to manage the data via api:
http://apiplatform.test:80/api10.Access to the next url to manage data from the Easy Admin Bundle:
http://apiplatform.test:80/admin