mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 16:29:29 +00:00
chore: update readme
This commit is contained in:
@@ -9,11 +9,13 @@ Testcontainers is a PHP package that makes it simple to create and clean up cont
|
|||||||
Add this to your project with composer
|
Add this to your project with composer
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer req --dev shyim/testcontainer
|
composer req --dev shyim/testcontainer
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage/Examples
|
## Usage/Examples
|
||||||
|
|
||||||
|
### MySQL
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -34,6 +36,57 @@ $pdo = new \PDO(
|
|||||||
// Do something with pdo
|
// Do something with pdo
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### MariaDB
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Testcontainer\Container\MariaDBContainer;
|
||||||
|
|
||||||
|
$container = new MariaDBContainer('8.0');
|
||||||
|
$container->withMariaDBDatabase('foo');
|
||||||
|
$container->withMariaDBUser('bar', 'baz');
|
||||||
|
|
||||||
|
$container->run();
|
||||||
|
|
||||||
|
$pdo = new \PDO(
|
||||||
|
sprintf('mysql:host=%s;port=3306', $container->getAddress()),
|
||||||
|
'bar',
|
||||||
|
'baz',
|
||||||
|
);
|
||||||
|
|
||||||
|
// Do something with pdo
|
||||||
|
```
|
||||||
|
|
||||||
|
### Redis
|
||||||
|
|
||||||
|
```php
|
||||||
|
|
||||||
|
use Testcontainer\Container\RedisContainer;
|
||||||
|
|
||||||
|
$container = new RedisContainer('6.0');
|
||||||
|
|
||||||
|
$container->run();
|
||||||
|
|
||||||
|
$redis = new \Redis();
|
||||||
|
$redis->connect($container->getAddress());
|
||||||
|
|
||||||
|
// Do something with redis
|
||||||
|
```
|
||||||
|
|
||||||
|
### OpenSearch
|
||||||
|
|
||||||
|
```php
|
||||||
|
|
||||||
|
use Testcontainer\Container\OpenSearchContainer;
|
||||||
|
|
||||||
|
$container = new OpenSearchContainer('2');
|
||||||
|
$container->disableSecurityPlugin();
|
||||||
|
|
||||||
|
$container->run();
|
||||||
|
|
||||||
|
// Do something with opensearch
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user