The primary goal of this project is to create a streamlined and efficient development environment using Docker Compose. This environment will consist of PHP-FPM, Xdebug, PHPUnit, Redis, Nginx web server, and MariaDB, enabling developers to quickly and easily start working on their PHP projects.
- Easy setup with docker compose and Dockerfile under usage from Docker
- Uses PHP 8.4.1 for better performance, lower CPU and memory usage
- And composer the dependency manager for PHP to start easy your project
- Built on the lightweight nginx 1.27.2 webserver
- Debugging with Xdebug 3.4.0beta1
- Testing with PHPUnit 11.4.3 to ensure code quality and reliability
- Redis 7.4.1 as session storage, database, cache, streaming engine, and message broker
- Database storage with MariaDB 11.6.2
-
Clone the repository:
git clone https://github.com/IshtarStar/docker-compose-nginx-phpfpm-xdebug-mariadb.git ./docker-skeleton cd docker-skeleton
-
Build and start the Docker containers:
docker compose up --build -d
-
Install Composer dependencies:
docker compose exec -T php-fpm composer install
-
Run PHPUnit tests with code coverage:
docker compose exec -T php-fpm ./vendor/bin/phpunit --coverage-text --testdox tests
An example PHPUnit test is included in the tests
directory.
See also: Blog-Post: Dockerize your PHP application with Nginx and PHP8 FPM