This project provides a basic Docker setup, for building a local development environment for Zend Expressive, and other PHP, application development.
Why? Good question. But easy to answer. The intent is to provide a starting point for developers to get up and running quickly, using Docker, to build a local development environment. If you’d like much more background as to why, checkout this tutorial on Master Zend Framework. It lays out, much more comprehensively, the reasons why this is a good thing to do.
To get up and running, after cloning the repository:
-
Install Docker. If you’re running a Linux distribution, use its package manager. If you’re using either macOS or Windows, download the respective Docker package installers: Docker for Mac or Docker for Windows.
-
Add the cloned files to the root of a Zend Expressive (or other PHP) project.
-
In
docker/nginx/default.conf
change the default document root setting,root /PATH/TO/YOUR/DOCUMENT/ROOT;
, to suit your installation. More than likely, there will be apublic/
directory in your source. So change the setting to beroot /var/www/html/public;
. -
Build the configuration by running:
docker-compose up -d
.
To check that the build is working, run docker-compose ps
.
This should give you output similar to the below.
Name Command State Ports
---------------------------------------------------------------------------------------------------------
dockerforlocaldevelopment_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
dockerforlocaldevelopment_nginx_1 nginx -g daemon off; Up 443/tcp, 0.0.0.0:8080->80/tcp
dockerforlocaldevelopment_php_1 php-fpm Up 9000/tcp
dockerforlocaldevelopment_testing_1 php-fpm Up 9000/tcp
If you’d like to see more detailed information, check the log file by running docker-compose logs
.
To check that the files are inside the container, run the following command, substituting dockerforlocaldevelopment
to match your directory name:
docker exec -it dockerforlocaldevelopment_nginx_1 ls -lahrt /var/www/html
See the CONTRIBUTING file.
This project is licensed under the MIT License.