This demo application based on the official Yii 2.0 Framework image on DockerHub for PHP.
These Docker images are built on top of the official PHP Docker image, they contain additional PHP extensions required to run Yii 2.0 framework, including basic demo application.
The Dockerfile
(s) of this repository are designed to build from different PHP-versions by using build arguments.
Please, check your settings git config --get core.autocrlf
and disable autocrlf
cp .env.example .env
Adjust the versions in .env
if you want to build a specific version. See .env-dist for details.
Note: Please make sure to use a matching combination of
DOCKERFILE_FLAVOUR
andPHP_BASE_IMAGE_VERSION
GITHUB_API_TOKEN
access key for repositories on GitHubGITLAB_ACCESS_TOKEN
access key for repositories in GitLabPHP_ENABLE_XDEBUG
whether to load an enable Xdebug, defaults to0
(false) not available in-min
imagesPHP_USER_ID
(Debian only) user ID, when running commands as webserver (www-data
), see also #15
docker-compose build
docker-compose up
docker-compose run --rm php-dev php /tests/requirements.php
docker-compose run --rm php-dev composer install
docker-compose run --rm php-dev yii migrate
Visit web interface http://localhost:8202/track, auth not required
http://localhost:8202/api/tracks
Authorization: use
Bearer 101-token
for development
curl -i -X POST \
-H "Authorization:Bearer 101-token" \
-H "Content-Type:application/json" \
-d \
'{
"track_number": "UANNmin5max255",
"status": "new"
}' \
'http://localhost:8202/api/tracks'
curl -i -X GET \
-H "Authorization:Bearer 101-token" \
'http://localhost:8202/api/tracks/1'
in response you see track structure
{
"id": 1,
"track_number": "UANNmin5max255",
"created_at": "2025-06-22 09:36:05",
"updated_at": null,
"status": "new"
}
curl -i -X PATCH \
-H "Authorization:Bearer 101-token" \
-H "Content-Type:application/json" \
-d \
'{
"status": "completed"
}' \
'http://localhost:8202/api/tracks/1'
curl -i -X DELETE \
-H "Authorization:Bearer 101-token" \
'http://localhost:8202/api/tracks/1'
curl -i -X GET \
-H "Authorization:Bearer 101-token" \
-H "Content-Type:application/json" \
'http://localhost:8202/api/tracks?filter%5Bstatus%5D=new'
curl -i -X PATCH \
-H "Authorization:Bearer 101-token" \
-H "Content-Type:application/json" \
-d \
'[
{
"status": "completed",
"id":2
},
{
"status": "in_progress",
"id":3
}
]' \
'http://localhost:8202/api/tracks/bulkupdate'
Track creation, modification & deletion is logged by LogBehavior to separate logfile _host-volumes\app\runtime\logs\track.log
current settings & best practices uses separate database to run tests isolated from development & production, so you need to prepare db or change settings in test_db
docker-compose run --rm db mysql -h db -u root -p
create database test;
CREATE USER 'test' IDENTIFIED BY 'test';
GRANT ALL ON test.* TO 'test';
exit;
docker-compose run --rm php-dev php tests/bin/yii migrate
docker-compose run --rm php-dev /app/vendor/bin/codecept run
docker-compose run --rm php-dev /app/vendor/bin/codecept run unit :Track
To enable Xdebug, set PHP_ENABLE_XDEBUG=1
in .env file
Xdebug is configured to call ip xdebug.remote_host
on 9005
port (not use standard port to avoid conflicts),
so you have to configure your IDE to receive connections from that ip.
More information can be found in the docs folder.
- We do not officially support Alpine images, due to numerous issues with PHP requirements and because framework tests are not passing.
- Depending on the (Debian) base-image (usually PHP <7.4) you might need to set
X_LEGACY_GD_LIB=1
- test
The following images are built on a weekly basis for arm64 and amd64. For regular commits on master we only build images for amd64 suffixed with -latest
/-latest-min
.
Minimal images
8.3-apache-min, 8.3-fpm-min, 8.3-fpm-nginx-min
8.2-apache-min, 8.2-fpm-min, 8.2-fpm-nginx-min
8.1-apache-min, 8.1-fpm-min, 8.1-fpm-nginx-min
Development images
8.3-apache, 8.3-fpm, 8.3-fpm-nginx
8.2-apache, 8.2-fpm, 8.2-fpm-nginx
8.1-apache, 8.1-fpm, 8.1-fpm-nginx