mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 09:29:35 +00:00
chore: Add PostgresContainer to README
This commit is contained in:
@@ -99,6 +99,28 @@ $pdo = new \PDO(
|
|||||||
// Do something with pdo
|
// Do something with pdo
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PostgreSQL
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Testcontainer\Container\PostgresContainer;
|
||||||
|
|
||||||
|
$container = new PostgresContainer('15.0', 'password');
|
||||||
|
$container->withPostgresDatabase('database');
|
||||||
|
$container->withPostgresUser('username');
|
||||||
|
|
||||||
|
$container->run();
|
||||||
|
|
||||||
|
$pdo = new \PDO(
|
||||||
|
sprintf('pgsql:host=%s;port=5432;dbname=database', $container->getAddress()),
|
||||||
|
'username',
|
||||||
|
'password',
|
||||||
|
);
|
||||||
|
|
||||||
|
// Do something with pdo
|
||||||
|
```
|
||||||
|
|
||||||
### Redis
|
### Redis
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|||||||
Reference in New Issue
Block a user