From ceae4473632bb419863087ae23c22017397da5a5 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sun, 23 Oct 2022 00:02:03 +0000 Subject: [PATCH] chore: update readme --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2b1d34..afa809e 100644 --- a/README.md +++ b/README.md @@ -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 ```bash - composer req --dev shyim/testcontainer +composer req --dev shyim/testcontainer ``` ## Usage/Examples +### MySQL + ```php 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