Phundament 4
Phundament is a dockerized 12factor PHP application template for Yii Framework 2.0.
Quick-Start
Clone the repository and go to the application directory
git clone https://github.com/phundament/app
Create environment configuration file
cd app
cp .env-dist .env
Inititalize the application
docker-compose run appcli composer install
docker-compose run appcli ./yii app/create-mysql-db
docker-compose run appcli ./yii migrate
docker-compose run appcli ./yii app/setup-admin-user
For alternative installation methods see the docs.
Make the application stack
docker-compose up -d
Find the port for the application nginx service
docker-compose port web 80
And open the application in your browser.
List all services
docker-compose ps
Show and follow logs
docker-compose logs
Configuration
docker-compose.yml
Environment - VIRTUAL_HOST
~^myapp\.
- Virtual-host configuration for reverse proxy, adjust the virtual host parameter for web application, we'll use it later to easily access the web-server through a wildcard DNS.
.env
Environment defaults - Identifier
APP_NS
namespace for the application, used i.e. for Docker image tags [a-z0-9]APP_ID
unique application and container identifier [a-z0-9]APP_NAME
display name of the application
Application
APP_MIGRATION_LOOKUP
comma separated list of Yii aliases to look for database migrations, eg.@app/migrations/data
APP_ADMIN_EMAIL
e-mail address of application admin userAPP_ADMIN_PASSWORD
password of application admin userAPP_SUPPORT_EMAIL
e-mail address for the application eg.support@myapp.local
APP_COOKIE_VALIDATION_KEY
unique and random string to prevent XSSAPP_PRETTY_URLS
enable or disable nice URLs, allowed values1
(yes) or0
(no)
Application development settings
APP_ASSET_FORCE_PUBLISH
force asset publishing after any changes to asset files. Note! This may degrade performance or cause permission issues, depending on your setup.
Framework
YII_DEBUG
wheter to enable more verbose application output, eg. on PHP exceptions.YII_ENV
Yii application mode, allowed valuesdev
,prod
ortest
YII_TRACE_LEVEL
amount of caller levels to display for logging.
Database
DB_ENV_MYSQL_DATABASE
database nameDB_ENV_MYSQL_PASSWORD
database passwordDB_ENV_MYSQL_USER
database userDB_PORT_3306_TCP_ADDR
database hostnameDB_PORT_3306_TCP_PORT
database port
config/main.php
PHP Application settings - For details of available application configuration, please refer to the Yii 2.0 Framework Definitive Guide.
Demo
A demo can be found at the Phundament Playground Application Demo! You can get the source-code of the demo application from its GitHub repository.