PHP code example of simondevelop / php-docker

1. Go to this page and download the library: Download simondevelop/php-docker 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/ */

    

simondevelop / php-docker example snippets



// Initiate
Docker;

$docker = new Docker("mysql:5.7", [
    "3306" => "3306"
], [
    "/my/own/datadir" => "/var/lib/mysql"
]);
$docker->setEnv([
    "MYSQL_ROOT_PASSWORD" => "my-secret-pw"
]);

echo $docker->run();
// docker run -d -v /my/own/datadir:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw mysql:5.7
bash
composer