Skip to content

php-dk/docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker

 - запуск контейнеров из PHP. 
 Восзможное использование в тестах
 
use ToolsPhp\docker\Composer;
use ToolsPhp\docker\containers\DbContainer;
use ToolsPhp\docker\Docker;

include DIR . "/../vendor/autoload.php";

$docker = Docker::getInstance(); $docker->factory([ 'postgres' => function(Composer $composer) { $composer->setPrototype(DbContainer::class); /** @var DbContainer $container */ $container = $composer->up(DIR . '/docker-composer.yml'); $container->setParamConnect('pgsql', 'postgres','postgres','postgres');

    return $container;
}

]);

/** @var DbContainer $postgres */ $postgres = $docker->get('postgres'); $postgres->start();

$pdo = $postgres->getPDO();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages