Skip to content
Go back

Quickly php setup

Updated:
Edit page

My goal with this post is to help you set up a PHP environment on your machine quickly and easily. I’ve seen people struggle to do this, and tutorials that require you to follow lots of steps. In the end, you can run PHP with just one command.

Requirements

Before we start, you MUST have two tools already installed on your computer.

  1. Git
  2. Docker

You must also be able to run docker without sudo, in case you didn’t have setup non root, check this article.

Check if it is working properly running the commands bellow 👇

git --version
docker compose version

For Windows users I would say that you must install WSL to have this working.

Let’s make this work 🚀

After you have done the requirements step, we can now run command to have this ready to play with php 🐘.

Copy and past the command bellow inside of your project folder.

bash <(curl -fsSL https://gist.githubusercontent.com/eerison/b79070bf142e4ea301867bd3308dadea/raw/easy-php-setup.sh)

Gist code

Commands

CommandDescription
docker compose up -dStart the containers
docker compose downStop containers
docker compose exec php composer installExecute some php command that you need, or composer command.

Frameworks

This project should work, out the box, for the most modern php frameworks such as Symfony and Laravel.

In case you just want to use the environment, you can remove all files and keep .docker and docker-compose.yml only.

For symfony setups look at: Quickly symfony setup Article

But if you find some strange behaviour, feel free to open an issue or even better provide a PR to improve the project 🚀.


Edit page
Share this post on:

Previous Post
Quickly symfony setup
Next Post
Automated Xdebug Setup in LazyVim Using Ansible