Giter VIP home page Giter VIP logo

php-docker-dev's Introduction

PHP Docker Development

A Docker template for PHP developers.

  1. A PHP container with defaults to run XCode step debugging with VSCode. The PHP also comes with composer installed for managing packages.
  2. NGINX to serve PHP files.
  3. A workspace folder volume is created so you can work on php files locally.

This can be very useful if you don't want to install or manage PHP setups directly on your machine.

Setup

  1. Copy ./php/conf.d/example-xdebug.ini to ./nginx/conf.d/xdebug.ini
  2. Copy ./php/conf.d/example-error_reporting.ini to ./nginx/conf.d/error_reporting.ini
  3. Copy ./nginx/conf.d/example-default.conf to ./nginx/conf.d/default.conf
  4. Copy ./.env.example to ./.env and set variables as necessary.
  5. Copy ./php/example-php.ini to ./php/php.ini
  6. docker compose up -d

Developing

Developing in this environment is easy. A ./workspace volume will be mounted. You can place your PHP files there.
By default the entrypoint is index.php.
Files such as images can be put here as well. For example, ./workspaces/images/image.png would be accessible at http://localhost:8080/images/image.png.

VSCode

Make sure to setup your .vscode/launch.json correctly. Path mappings need to be setup for XDebug to work correctly.
Launch debug with defults and modify launch.json similar to this:

{
    "configurations": [
            {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9003,
                "pathMappings": {
                    "/var/www/html": "${workspaceFolder}",
                }
            },
    ]
}```

php-docker-dev's People

Contributors

jwnukoski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.