PHP docker images for local development. All images contain:
- PHP with extensions: BCMath, intl, Gettext, Sockets, PDO (MySQL, PostgreSQL), APCu, Memcached, Process Control (PCNTL)
- Bash terminal with predefined aliases
- Starship shell prompt
- Composer with completion
- GIT
- GnuPG for sign commits
- OpenSSH authentication agent (
ssh-agent
)
Image on DockerHub, docker pull command:
docker pull vjik/dev-php:8.3
Development tags:
- Node.js
- Xdebug
- OPcache PHP extension
- GitHub Lookup Next ID Utility
- uopz PHP extension
Tag | PHP version | Xdebug | uopz |
---|---|---|---|
8.3 | 8.3 | ✔️ | ❌ |
8.2 | 8.2 | ✔️ | ❌ |
8.1 | 8.1 | ✔️ | ❌ |
8.0 | 8.0 | ✔️ | ❌ |
7.4 | 7.4 | ✔️ | ❌ |
8.1-uopz | 8.1 | ✔️ | ✔️ |
Benchmark tags:
- OPcache PHP extension
Tag | PHP version | OPcache |
---|---|---|
8.2-bench | 8.2 | ❌ |
8.2-bench-opcache | 8.2 | ✔️ |
Recommended run command:
docker run -it --rm --name dev-php -v /host/projects:/projects -w /projects vjik/dev-php:8.3
-it
— Interactive mode with allocate a pseudo terminal.--rm
— Automatically remove the container when it exits.--name dev-php
— Assign name "dev-php" to the container.-v /host/projects:/projects
— Mount folder with your projects (replace/host/projects
to your path) to container (/projects
).-w /projects
— Set/projects
as working directory inside the container.vjik/dev-php:8.3
— Image name.
If you use WSL in Windows recommended to add the same username and group as in your system:
docker run -it --rm --name dev-php -v /host/projects:/projects -w /projects vjik/dev-php:8.3 --uname `id -un` --uid `id -u` --gname `id -gn` -gid `id -g`
--uname `id -un`
— Set username in container (id -un
returns current user name).--uid `id -u`
— Set user ID in container (id -u
returns current user ID).--gname `id -gn`
— Set user group name in container (id -gn
returns current user group name).--gid `id -g`
— Set user group ID in container (id -g
returns current user group ID).
You can configure SSH in container via mount folder with SSH configuration to path /config/.ssh
. To do this, add the
appropriate argument to the container run command. For example:
-v ~/.ssh:/config/.ssh
You can configure GIT in container via mount configuration file .gitconfig
to path /config/.gitconfig
. To do this,
add the appropriate argument to the container run command. For example:
-v ~/.gitconfig:/config/.gitconfig
You can configure GnuPG in container via mount folder with GnuPG configuration to path /config/.gnupg
. To do this, add the
appropriate argument to the container run command. For example:
-v ~/dev-gnupg:/config/.gnupg
Recommend don't use system .gnupg
directory. Better create new directory and mount it.
To request passphrase in terminal add pinentry-mode loopback
option to gpg.conf
file (create if not exist).
Alias | Command |
---|---|
c | composer |
cu | composer update |
pu | ./vendor/bin/phpunit |
puc | ./vendor/bin/phpunit --coverage-html=cover |
puct | ./vendor/bin/phpunit --coverage-text |
puf | ./vendor/bin/phpunit --filter |
psalm | ./vendor/bin/psalm --no-cache |
psalm74 | ./vendor/bin/psalm --no-cache --php-version=7.4 |
psalm80 | ./vendor/bin/psalm --no-cache --php-version=8.0 |
psalm81 | ./vendor/bin/psalm --no-cache --php-version=8.1 |
psalm82 | ./vendor/bin/psalm --no-cache --php-version=8.2 |
psalm83 | ./vendor/bin/psalm --no-cache --php-version=8.3 |
cls | clear |
Use Task for simplify run.