/cookiecutter-php-docker

An opinionated Cookiecutter template for running PHP projects in Docker.

Primary LanguageDockerfileBSD 3-Clause Clear LicenseBSD-3-Clause-Clear

Docker for PHP

An opinionated Cookiecutter template for running PHP projects in Docker.

Features

  • Uses MySQL as database.
  • Uses Caddy as web-server (optionally with Cloudflare plugin).
  • Serves on HTTPS.
  • Serves files from public folder by default.
  • Uses Alpine or Debian for PHP docker images.
  • Composer as package management.
  • Includes a development mail server.
  • Includes example dotenv files compatible with dotenver.
  • Allows for custom SSL certificates to be used.

How to use

Run the following commands inside you root projects directory.

# Grab cookie and generate files
cookiecutter gh:jmfederico/cookiecutter-php-docker
# Automatically generate dotenv files
docker run --rm -v "`pwd`:/var/lib/dotenver/" jmfederico/dotenver
# Initialize composer project
composer require psy/psysh
# Build and run Docker images
docker-compose build
docker-compose up -d

Now you can visit https://localhost/

Running commands

The recommended way to run commands is inside the PHP container:

docker-compose run --rm php-fpm vendor/bin/psysh