My dev environment for php projects

Project development requires not only programming skills but also the ability to set up an effective working environment. In this article, I'll share my experience in creating a dev environment for PHP projects using Docker. I'll explain how to organize the file structure, configure Dockerfile and docker-compose.yml, and share useful tips on optimization and security. Whether you're working on a pet project or preparing for team development, these practices will help you create a reliable and flexible development environment.

Dev environment with Docker (generated by ChatGPT)

This environment is based on my favorite and most frequently used tools:


September 30, 2024
About 6 min
An example of setting up xDebug in docker

Once upon a time, I put together a working environment with PHP, xDebug, Docker and PhpStorm. Since then, I have been dragging it from project to project and felt happy. For those who find it difficult to set up a local environment with Docker and xDebug, I am posting this config with explanations. Here below we will create a Docker image with xDebug installed, configure PhpStorm and explain a working configuration for Docker Compose.

xDebug setup example in docker

January 21, 2023
About 3 min
How to use PHP without installing it (Linux)

The answer is definitely simple: use Docker 😃 Benefits I get from using PHP like this:

  • No need to bother with setting up a local environment, switching PHP versions, installing additional libraries and resolving conflicts
  • One text file with command line aliases is enough for any version of PHP to work on any computer. And from here
    • Ease of transferring data between machines
    • You can safely demolish the system on your main computer, restoring work with PHP will be as simple as git pull

Note

This article is about parsing the use of docker in one specific scenario, so if you are already familiar with this technology, you can safely skip it. The rest of you are welcome to the further reading.

How to use PHP without installing it

August 19, 2022
About 5 min