Building your API with Laravel.
- Install dependencies.
- Install
docker
, it's used for development. - Install PHP and
composer
on your machine, this is optional since you can ssh into the docker container and run PHP andcomposer
there instead.
- Replace all
laravel-api
indocker-compose.yml
with your custom app name (in snake-case). - Copy
.env.example
to.env
.. - Replace
Laravel API
in.env
with your app name. - Update
DB_DATABASE
in.env
with a desired database name.
# Run this on your machine if you have PHP/composer installed
# Otherwise you should run it inside your docker container
composer install
# Run this on your machine
docker-compose up -d
Then open http://localhost:8080
Adding routes directly to routes/api.php
, we have removed the /api
prefix for you.
docker exec -it <container_name> /bin/bash