phundament / app
12factor Application Template for Yii 2.0 Framework
Installs: 11 748
Dependents: 0
Suggesters: 0
Security: 0
Stars: 309
Watchers: 46
Forks: 129
Open Issues: 30
Type:project
Requires
- dmstr/yii2-cms-metapackage: ^5.0.1
- vlucas/phpdotenv: 2.*
- yiisoft/yii2: ^2.0.7
- yiisoft/yii2-codeception: ^2.0
Requires (Dev)
- dmstr/yii2-cms-dev-metapackage: ^1.1.0
- dev-master
- 4.5.0
- 4.4.0-rc1
- 4.3.0
- 4.3.0-rc2
- 4.3.0-rc1
- 4.3.0-beta6
- 4.3.0-beta5
- 4.3.0-beta4
- 4.3.0-beta3
- 4.3.0-beta2
- 4.3.0-beta1
- 4.2.0
- 4.2.0-rc2
- 4.2.0-rc1
- 4.1.0
- 4.0.2
- 4.0.1
- 4.0.0
- 4.0.0-rc16
- 4.0.0-rc15
- 4.0.0-rc14
- 4.0.0-rc13
- 4.0.0-rc12
- 4.0.0-rc11
- 4.0.0-rc10
- 4.0.0-rc9
- 4.0.0-rc8
- 4.0.0-rc7
- 4.0.0-rc6
- 4.0.0-rc5
- 4.0.0-rc4
- 4.0.0-rc1
- 4.0.0-beta13
- 4.0.0-beta12
- 4.0.0-beta11
- 4.0.0-beta10
- 4.0.0-beta9
- 4.0.0-beta8
- 4.0.0-beta7
- 4.0.0-beta6
- 4.0.0-beta5
- 4.0.0-beta4
- 4.0.0-beta3
- 4.0.0-beta2
- 4.0.0-beta1
- 4.0.0-alpha1
- 3.0.24
- 3.0.23
- 0.22.0
- 0.21.0
- 0.20.6
- 0.20.5
- 0.20.4
- 0.20.3
- 0.20.2
- 0.20.1
- 0.20.0
- 0.19.1
- 0.19.0
- 0.18.1
- 0.18.0
- 0.17.1
- 0.17.0
- 0.16.0
- 0.15.1
- 0.15.0
- 0.14.2
- 0.14.1
- 0.14.0
- 0.13.0
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.1
- 0.11.0
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-develop
- dev-feature/postgres
- dev-feature/scrutinizer
This package is auto-updated.
Last update: 2024-03-13 00:32:06 UTC
README
phd4
formerly known as Phundament 4
phd is a dockerized 12factor PHP application template for Yii Framework 2.0.
- Full documentation
- Demo at Phundament playground
Requirements
- docker
- docker-compose >=1.6.2
For alternative installation methods, such as composer, see the docs.
Installation
Download or clone the repository and go to the application directory
git clone https://github.com/phundament/app
cd app
Heads up! Phundament features
Makefile
targets for development and continuous integration, typemake help
to see all available targets ormake all
to run installation and setup.
Create environment configuration files
cp .env-dist .env
cp docker-compose.override-dist.yml docker-compose.override.yml
Start the application stack
docker-compose up -d
Run setup commands
docker-compose run php composer install
docker-compose run php setup.sh
After startup is complete, open http://<DOCKER_HOST>:40080
to access the application and login with admin
/admin
.
Configuration
Environment overrides - docker-compose.override.yml
- host-volumes for local development
- port mappings
Environment defaults - docker-compose.yml
You can override any ENV variable in .env
within a docker-compose.yml
file.
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.
Application defaults - .env
During development, it is recommended to change application configuration in the .env
file, since it does not require restarting the containers.
Application
APP_NAME
unique application and container identifier [a-z0-9]APP_TITLE
display name of the applicationAPP_LANGUAGES
available languages for URL manager (eg.en,de
)APP_ADMIN_EMAIL
e-mail address of application admin user (default in./yii app/create-admin-user
)APP_ADMIN_PASSWORD
password of application admin user (default in./yii app/create-admin-user
)APP_MIGRATION_LOOKUP
comma separated list of Yii aliases to look for database migrations, eg.@app/migrations/data
APP_CONFIG_FILE
custom configuration file to loadAPP_COOKIE_VALIDATION_KEY
unique and random string to prevent XSSAPP_PRETTY_URLS
enable or disable nice URLs, allowed values1
(yes) or0
(no)APP_ASSET_FORCE_PUBLISH
force asset publishing after any changes to asset files. Note! This may degrade performance, use only during development.
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_ROOT_USER
user to create databasesDB_ENV_MYSQL_ROOT_PASSWORD
root password, eg. set from"${DB_ENV_MARIADB_PASS}"
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 portDATABASE_TABLE_PREFIX
table prefix for default database connection
Application configuration - config/main.php
For details of available application configuration, please refer to the Yii 2.0 Framework Definitive Guide.
Settings
Web UI for application wide key-value store.
pages
SitemapavailableRoutes
schmunk42.markdocs
MarkdownmarkdownUrl
URL or local path for markdown eg.https://raw.githubusercontent.com/phundament/docs/master
defaultIndexFile
eg.1-introduction/about.md
cms.assets
Assets/LESSuseDbAsset
boolean
Users & permissions
Default users
admin
Default roles
Editor
Public
💡 To enable public access you need to assign permissions, like app_site
, docs_default
, to the Public
role.
Testing
First, build your application image
docker-compose build
Set environment variables for test stack
export COMPOSE_PROJECT_NAME=testapp
export BUILD_PREFIX=app
Start test stack and enter tester CLI container
docker-compose -f docker-compose.yml -f build/compose/test.override.yml up -d
docker-compose -f docker-compose.yml -f build/compose/test.override.yml run tester bash
Setup application (container bash)
$ setup.sh
Run test suites (container bash)
$ codecept run functional prod
$ codecept run acceptance prod
ℹ️
YII_ENV
must be set totest
when running codeception.
Deployment
Required variables for building & pushing docker images.
REGISTRY_USER
REGISTRY_PASS
REGISTRY_HOST
IMAGE_NAME
Links
- Documentation
- Project Source-Code
- Website
- Team
- Imprint
- Version
- Packagist
- GitLab CI
- Travis CI
Built by *dmstr, Stuttgart 🇩🇪