/yii2-dockerized

A template for docker based Yii 2 applications

Primary LanguagePHP

Yii 2 Dockerized

Latest Stable Version Total Downloads

A template for Yii 2 applications based on the codemix/yii2-base docker image.

  • Ephemeral container, configured via environment variables
  • Testing container for easy testing
  • Optional local configuration overrides for development/debugging (git-ignored)
  • Base scaffold code for login, signup and forgot-password actions
  • Flat configuration file structure
  • Supports docker image based development workflow

The yii2-base image comes in three flavours:

  • Apache with PHP module (based on php:5.6.10-apache)
  • PHP-FPM (based on php:5.6.10-fpm)
  • HHVM (based on estebanmatias92/hhvm:3.7.0-fastcgi)

Quickstart

You need to have docker (>=1.5.0) and docker-compose installed.

composer create-project --no-install codemix/yii2-dockerized myproject
cd myproject
cp docker-compose-example.yml docker-compose.yml
cp .env-example .env
docker-compose up
# From another terminal window:
docker-compose run --rm web ./yii migrate

It may take some minutes to download the required docker images. When done, you can access the new app from http://localhost:8080.

Note: If you don't have composer installed locally you can also use a docker container to use composer:

docker run --rm -v /srv/projects:/var/www/html codemix/yii2-base:2.0.7-apache composer create-project --no-install codemix/yii2-dockerized myproject

Please check the Wiki for full documentation.