How to Instantly Spin Up a Full PHP Development Stack with Laradock

This guide explains how Laradock provides a ready‑to‑use Docker‑based PHP development environment, covering its configurable .env file, seamless PHP version switching, Chinese mirror acceleration, custom container builds, and step‑by‑step commands to launch services like NGINX, MySQL, Redis, and Composer.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Instantly Spin Up a Full PHP Development Stack with Laradock

Introduction

Laradock is a Docker‑based, all‑in‑one PHP development environment that ships with a large set of pre‑configured services and extensive customization options, allowing developers to obtain a fully functional PHP stack within seconds.

Key Features

Seamless PHP version switching : Switch among PHP 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 5.6, etc., with a single configuration change.

Flexible database selection : Choose MySQL, PostgreSQL, MariaDB, and many others.

Customizable service stack : Add services such as Memcached, HHVM, RabbitMQ, and more.

Isolated containers : Each component runs in its own Docker container for clear separation.

Easy customization : Edit the Dockerfile to modify any container.

Trusted base images : All images are built on official Docker base images for reliability and security.

Pre‑configured web servers : Out‑of‑the‑box NGINX configuration that serves code from the project root.

Transparent configuration : All files are visible and editable, giving full control over the environment.

Fast builds : Quickly build images so the environment starts and runs promptly.

Supported Services

Laradock follows the “separation of concerns” principle, providing independent containers for a wide range of services, including web servers (NGINX, Apache2, Caddy), load balancers (HAProxy, Traefik), PHP runtimes (PHP‑FPM, HHVM), databases (MySQL, PostgreSQL, MariaDB, Percona, MSSQL, MongoDB, Neo4j, CouchDB, RethinkDB, Cassandra), caching engines (Redis, Memcached, Varnish), message brokers (RabbitMQ, Beanstalkd, Mosquitto, Gearman), log management (GrayLog, Kibana, LogStash), search engines (ElasticSearch, Solr, Manticore, Dejavu), PHP extensions (Swoole, Blackfire, Phalcon, Laravel Horizon), mail servers (Mailu, MailCatcher, Mailhog, MailDev), real‑time communication tools (Laravel Echo, Mercure), monitoring (Grafana, NetData), coordination services (ZooKeeper), container management tools (Portainer, Docker Registry, Docker Web UI), CI/CD utilities (Jenkins, SonarQube, Gitlab), cloud tools (AWS EB CLI, SQS), image processing (Thumbor), interactive computing (IPython, Jupyter Hub), security tools (Certbot), object storage (Minio), testing (Selenium), IDEs (ICE Coder, Theia, Web IDE), and a rich workspace with PHP CLI, Composer, Git, Vim, xDebug, Node, Gulp, Yarn, and more.

Quick Setup Overview

Clone the Laradock repository into your PHP project:

git clone https://github.com/Laradock/laradock.git

Enter the laradock directory and copy .env.example to .env: cp .env.example .env Start the desired containers (e.g., NGINX, MySQL, phpMyAdmin, Redis, workspace):

docker-compose up -d nginx mysql phpmyadmin redis workspace

Adjust the project’s .env to point to the containers, for example:

DB_HOST=mysql
REDIS_HOST=redis
QUEUE_HOST=beanstalkd

Open a browser and visit http://localhost to see the running stack.

“That’s it! Enjoy your ready‑to‑use development environment :)”
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerBackend DevelopmentPHPDocker ComposeDev EnvironmentLaradock
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.