andreipetcu/docker-php

v1.1.1 2017-11-01 14:00 UTC

README

Docker PHP 是一个用于简化 PHP 中 docker/docker-compose 使用的封装工具。

Latest Version Build Status Software License

安装

composer require andreipetcu/docker-php

使用方法

<?php

use AndreiPetcu\DockerPhp\Docker;
use AndreiPetcu\DockerPhp\DockerCompose;
use Symfony\Component\Process\ProcessBuilder;

$compose = new DockerCompose(new ProcessBuilder());
$compose->setPath('/path/to/project')
    ->setNamespace('awesome');

$docker = new Docker(new ProcessBuilder());

// All commands accept either a service as a string or an array of services
// and a verbose flag which defaults to false
$compose->build('nginx', true)
    ->start('nginx', true)
    ->restart('nginx', true)
    ->stop('nginx', true)
    ->destroy('nginx', true);

// Will ssh into awesome_nginx_1
$compose->start('nginx')
    ->docker($docker)
    ->ssh('nginx');

// Will ssh into the given container.
$docker->ssh('container');

许可证

MIT 许可证(MIT)。更多详细信息请参阅许可证文件