Giter Site home page Giter Site logo

dreadwarrior / php-workshop-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthiasnoback/php-workshop-tools

0.0 1.0 0.0 123 KB

A set of useful utilities for PHP workshop code bases that I would otherwise write again and again.

Home Page: https://training.matthiasnoback.nl/

License: MIT License

Shell 3.43% PHP 94.54% HTML 0.02% Dockerfile 2.01%

php-workshop-tools's Introduction

PHP Workshop tools

Build Status

Take docker-compose.example.yml as an example for using the simple webserver image provided by this project.

Required environment variables

You'll need to export the following environment variables:

export HOST_GID=$(id -g)
export HOST_UID=$(id -u)
export COMPOSER_HOME="${HOME}/.composer"

To make these always available, you could add the above lines to your ~/.bash_profile file.

Optional environment variables

You only need to provide the DOCKER_HOST_IP environment variable if you want to use XDebug for step debugging.

When using Docker for Mac and Docker for Windows

export DOCKER_HOST_IP=host.docker.internal

When using Linux

Export the IP of your machine on the local network (e.g. 192.x.x.x or 10.x.x.x) as the DOCKER_HOST_IP environment variable, e.g.

export DOCKER_HOST_IP=192.168.1.33

Setting up XDebug with PhpStorm (optional)

For each PHP-based service defined in your docker-compose.yml, you should take the following steps:

  • In PhpStorm go to Preferences - Languages & Frameworks - PHP - Servers create a new server with the same name as the service itself in docker-compose.yml, using host 0.0.0.0, and the host port (e.g. 8080). Then select the root directory of the project and in the right column type in the absolute path of the project directory inside the Docker container (i.e. /opt).

  • Make sure that in docker-compose.yml the PHP_IDE_CONFIG environment variable has been defined containing the name of the server (the same one you provided in the previous step).

  • Also make sure you have defined an XDEBUG_CONFIG environment variable for the service in docker-compose.yml. (The remote_log setting is optional; it will print debug information to stdout, which will be helpful in case you have trouble setting up XDebug.)

    services:
        website:
            image: matthiasnoback/php_workshop_tools_simple_webserver
            ports:
                - 8080:80
            # ...
            environment:
                PHP_IDE_CONFIG: "serverName=website"
                XDEBUG_CONFIG: "remote_host=${DOCKER_HOST_IP} remote_log=/dev/stdout"
  • In PhpStorm go to Preferences - Languages & Frameworks - PHP - Debug and make sure you listen to port 9000.

  • On the same page, increase the number of "Max. simultaneous connections" (to allow debugging multiple PHP services at the same time).

  • In PhpStorm select Run - Start listening for PHP Debug Connections.

  • In PhpStorm set a breakpoint in - for example - the index.php of the website. Optionally select Run - Break at first line in PHP scripts.

  • Now run the service and request the index page. PhpStorm should show a dialogue asking you to accept an incoming debug connection.

php-workshop-tools's People

Contributors

danielschwiperich avatar matthiasnoback 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.