This setup is great for writing quick apps in PHP using Lumen from an any Docker client. It uses docker-compose to setup the application services.
git clone git@github.com:AngCosmin/docker-lumen-mysql.git lumen
cd lumen
To change configuration values, look in the docker-compose.yml
file and change the php
container's environment variables. These directly correlate to the Lumen environment variables.
docker-compose up --build -d
-d
: run as deamon (optional)
docker exec app composer install
Navigate to http://localhost:80
Success! You can now start developing your Lumen app on your host machine and you should see your changes on refresh! Classic PHP development cycle. A good place to start is images/php/app/routes/web.php
.
Feel free to configure the default port 80 in docker-compose.yml
to whatever you like.
docker-compose down
cd images/php
docker run --rm -it -v $(pwd):/app saada/lumen-cli lumen new app
To allow Lumen to use database navigate to images/php/app/bootstrap
and open app.php
. Uncomment these two line:
$app->withFacades();
$app->withEloquent();
Done!
Run heroku login
- Navigate to
images\php\app
- If you don't already have the file
Procfile
then create it and add this inside
web: vendor/bin/heroku-php-apache2 public/
git init
heroku create --region eu myapp
heroku config:set APP_KEY=SomethingRandom
git add .
git commit -m "First commit"
git push heroku master
- Go to https://data.heroku.com/
- Create Heroku Postgres -> Install Heroku Postgres
- Search for your app (myapp) created before press Create
- Go to https://data.heroku.com/ and click your database
- Go to Setting -> View credentials and set env variables for Lumen project like this:
heroku config:set DB_CONNECTION=pgsql DB_HOST=... DB_DATABASE=... DB_USERNAME=... DB_PASSWORD=... DB_PORT=...
- Open application
heroku open
Note:
To run artisan commands use heroku run php artisan ...
.
If you want debugger you can run heroku config:set APP_DEBUG=true APP_ENV=development
Submit a Pull Request!