PHPDocker.io Documentation

repository·master·Indexed 21 days ago

https://github.com/phpdocker-io/phpdocker.io

A web-based generator for creating tailored Docker environments for PHP applications. It provides a core engine and web interface to configure PHP versions, extensions, and integrated services including MySQL, MariaDB, PostgreSQL, Redis, Memcached, Elasticsearch, ClickHouse, and Mailhog. The tool generates a complete environment archive containing Dockerfile, docker-compose.yml, and Nginx/PHP configurations.

Tokens
4.2K
Snippets
13
Records
26
Agent score
75%

What's inside PHPDocker.io

  1. Install and set up PHPDocker.io

    master

    The recommended way to install PHPDocker.io is by using the make init command. This command automates the entire setup process within a Docker environment, including cache cleanup, SSL provisioning, host entry creation, and dependency installation.

    Prerequisites:

    • Docker and Docker Compose
    • mkcert (required for local SSL generation)
    • make

    Setup Steps:

    1. Run make init.
    2. Once complete, the application is accessible at https://phpdocker.local:10000.
    3. Navigate to the /generator route to use the core functionality.
    make init
  2. Run PHPDocker.io on Windows

    master

    To run PHPDocker.io on Windows, you must use WSL2 and Docker Desktop with the WSL 2 backend.

    When running on Windows via WSL2, the application will be available at https://localhost:10000 instead of the phpdocker.local domain used on Linux/macOS.

  3. Set up Xdebug debugging in Visual Studio Code

    master

    Create a .vscode/launch.json file with the following configuration. Ensure the pathMappings correctly maps the container's application path to your local workspace root.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Docker",
                "type": "php",
                "request": "launch",
                "port": 9000,
                "pathMappings": {
                    "/application/public": "${workspaceRoot}/"
                }
            }
        ]
    }
  4. Set up Xdebug debugging in PHPStorm

    master
    1. Update docker-compose.yml: Add the PHP_IDE_CONFIG environment variable to the php-fpm service:
    environment:
      PHP_IDE_CONFIG: "serverName=Docker"
    1. Configure PHPStorm:
      • Go to Preferences | Languages & Frameworks | PHP | Servers.
      • Add a new server where the Name matches the serverName from docker-compose.yml (e.g., Docker).
      • Set the Port to the same port used by your webserver service.
      • Enable Use path mappings and map your local project path to the container path.
    2. Use Xdebug helper browser extension to trigger debugging.
    environment:
      PHP_IDE_CONFIG: "serverName=Docker"
  5. Install and set up PHPDocker.io environment

    master

    To add a PHPDocker.io generated environment to your project:

    1. Unzip the generated files into your project root. This creates a docker-compose.yml file and a phpdocker/ directory containing Nginx and PHP-FPM configurations.
    2. Verify Nginx configuration: Check phpdocker/nginx/nginx.conf to ensure the front controller location (e.g., public/index.php) matches your project structure.
    3. Adjust paths if necessary: If you move the files to a different location, you must update the paths for the php-fpm Dockerfile, php.ini overrides, and Nginx configuration within docker-compose.yml.

    Prerequisites:

    • Docker
    • Docker Compose
    cd /path/to/your/project
    docker-compose up -d
  6. Run the PHPDocker.io CLI via bin/console

    master

    The bin/console script is the primary CLI entrypoint for managing the PHPDocker.io application using Symfony console commands. It requires that project dependencies are installed via Composer and that the Symfony Runtime is present.

    php bin/console
  7. Configure Postgres service options

    master

    When setting up a project with a Postgres service, the following configuration fields are available. Validation for these fields (such as length and presence) is only enforced if the hasPostgres checkbox is enabled.

    Configuration Fields

    FieldTypeDescription
    hasPostgresCheckboxEnables the Postgres service in the project generator.
    versionChoiceThe specific Postgres version to use (options provided by Postgres::getChoices()).
    rootUserTextThe username for the root user (e.g., postgres).
    rootPasswordTextThe password for the root user.
    databaseNameTextThe name of the database for your application.

    Validation Rules

    When hasPostgres is true, the following constraints are applied to version, rootUser, rootPassword, and databaseName:

    • NotBlank: The field cannot be empty.
    • Length: The value must be between 2 and 128 characters.