1. Go to this page and download the library: Download programster/docker-compose library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
programster / docker-compose example snippets
Programster\DockerCompose\Port;
use \Programster\DockerCompose\Volume;
use \Programster\DockerCompose\PortCollection;
use \Programster\DockerCompose\EnvironmentVariableCollection;
use \Programster\DockerCompose\EnvironmentVariable;
use \Programster\DockerCompose\Service;
use \Programster\DockerCompose\RestartEnum;
use \Programster\DockerCompose\VolumeCollection;
use \Programster\DockerCompose\DockerCompose;
$hydraPortCollection = new PortCollection(
new Port(4444, 4444),
new Port(4445,4445),
new Port(5555,5555),
);
$hydraDataVolume = Volume::createBindVolume(
$hostPath = "./hydra",
$containerPath = "/etc/config/hydra"
);
$environment = new EnvironmentVariableCollection(
new EnvironmentVariable("DSN", "postgres://hydra:bob@sally:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4")
);
$hydraService = new Service(
name: "hydra",
image: "oryd/hydra:v1.10.3",
containerName: "hydra",
ports: $hydraPortCollection,
restart: RestartEnum::createUnlessStopped(),
volumes: new VolumeCollection($hydraDataVolume),
environmentVariables: $environment,
command: 'serve -c /etc/config/hydra/hydra.yml all --dangerous-force-http'
);
$config = new DockerCompose("3.8", $hydraService);
print $config;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.