|
1 | 1 | # Docker compose PHP 8.3.8, Xdebug 3.4.0, Nginx 1.27.0, Redis 7.2.5 and MariaDB 11.4.2
|
2 | 2 |
|
3 | 3 | 
|
| 4 | + |
4 | 5 | 
|
5 | 6 | 
|
6 |
| - |
| 7 | + |
7 | 8 | 
|
8 | 9 | 
|
9 | 10 |
|
|
12 | 13 | * And [composer the dependency manager for PHP](https://getcomposer.org) to start easy your project
|
13 | 14 | * Built on the lightweight [nginx 1.27.0](https://nginx.org) webserver
|
14 | 15 | * Debugging with [Xdebug 3.3.2](https://xdebug.org)
|
| 16 | +* Testing with [PHPUnit 11.2.1](https://phpunit.de) to ensure code quality and reliability |
15 | 17 | * [Redis 7.2.5](https://redis.io) as session storage, database, cache, streaming engine, and message broker
|
16 | 18 | * Database storage with [MariaDB 11.4.2](https://mariadb.org)
|
17 | 19 |
|
| 20 | +## Setup Instructions |
| 21 | + |
| 22 | +1. **Clone the repository:** |
| 23 | + ```sh |
| 24 | + git clone https://github.com/IshtarStar/docker-compose-nginx-phpfpm-xdebug-mariadb.git ./docker-skeleton |
| 25 | + cd docker-skeleton |
| 26 | + ``` |
| 27 | + |
| 28 | +2. **Build and start the Docker containers:** |
| 29 | + ```sh |
| 30 | + docker-compose up --build -d |
| 31 | + ``` |
| 32 | + |
| 33 | +3. **Install Composer dependencies:** |
| 34 | + ```sh |
| 35 | + docker-compose exec -T php-fpm composer install |
| 36 | + ``` |
| 37 | + |
| 38 | +4. **Run PHPUnit tests:** |
| 39 | + ```sh |
| 40 | + docker-compose exec -T php-fpm ./vendor/bin/phpunit tests |
| 41 | + ``` |
| 42 | + |
| 43 | +## Example PHPUnit Test |
| 44 | + |
| 45 | +An example PHPUnit test is included in the `tests` directory: |
| 46 | + |
| 47 | +```php |
| 48 | +// tests/ExampleTest.php |
| 49 | + |
| 50 | +<?php |
| 51 | + |
| 52 | +use PHPUnit\Framework\TestCase; |
| 53 | + |
| 54 | +class ExampleTest extends TestCase |
| 55 | +{ |
| 56 | + public function testExample() |
| 57 | + { |
| 58 | + $this->assertTrue(true); |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
18 | 63 | See also:
|
19 | 64 | [Blog-Post: Dockerize your PHP application with Nginx and PHP8 FPM](https://marc.it/dockerize-application-with-nginx-and-php8/)
|
0 commit comments