← All work
Open source Free & open source

Laravel Bootstrap CLI

Automated Local Development Environment Setup

Type
Open source
Built with
Bash, Shell Scripting, nginx
Toolkit
5 technologies

Overview

A productivity-focused command-line tool that automates the entire Laravel project setup workflow on Linux systems.

Designed to eliminate repetitive manual configuration, this tool streamlines the process of setting up a professional, nginx-based local development environment with a single command.

The CLI handles all critical setup steps automatically: Laravel project creation, PHP-FPM configuration with version selection, MySQL database initialisation, local domain registration, SSL certificate generation (via mkcert), nginx vhost configuration, and environment file setup. Developers can spin up a fully configured Laravel project in minutes instead of spending 30+ minutes on manual configuration.

With sensible defaults, flexible CLI options, and clear documentation, this tool reflects a real-world development workflow and is particularly valuable for developers working on multiple Laravel projects simultaneously.

The hard parts

What made it tricky.

Every project has a few problems that decide whether it works in real life. These were the ones here, and how we handled them.

  1. 01

    Automation Complexity

    Challenge

    Orchestrating multiple system-level operations (DNS, nginx config, SSL generation, database creation) in a reliable sequence

    Solution

    Built modular bash functions with error handling and validation at each step, with clear separation of concerns

  2. 02

    Cross-Version PHP Support

    Challenge

    Supporting multiple PHP versions while correctly routing to the appropriate PHP-FPM socket

    Solution

    Implemented dynamic PHP-FPM socket detection based on the selected version, with validation to ensure the version exists on the system

  3. 03

    Permission Management

    Challenge

    Handling file and directory permissions correctly for nginx and PHP-FPM to avoid permission-denied errors

    Solution

    Implemented automatic permission fixing for Laravel directories and proper ownership assignment during setup

  4. 04

    Nginx Configuration

    Challenge

    Generating nginx vhost configurations programmatically that are compatible with Laravel and HTTPS

    Solution

    Created template-based vhost generation with proper socket paths, SSL directives, and Laravel-specific location blocks

  5. 05

    SSL Certificate Generation

    Challenge

    Providing trusted local SSL certificates without manual intervention

    Solution

    Integrated mkcert support with fallback graceful handling if not installed

  6. 06

    Bash Script Clarity

    Challenge

    Keeping a complex bash script maintainable and understandable

    Solution

    Extensively documented code with clear comments, logical function organisation, and helpful error messages

  7. 07

    Features Highlights

    One-Command Setup

    Eliminates 10+ manual steps with a single command

    Smart Defaults

    Sensible configuration options reduce required input

    Flexible Configuration

    CLI arguments allow customisation of project name, domain, and PHP version

    Sudo Privilege Handling

    Prompts once for sudo access instead of repeatedly

    Browser Integration

    Automatically opens the newly created project in the default browser

    Real-World Environment

    Uses nginx + PHP-FPM + MySQL, matching production-like setups

Under the hood

The stack.

  • Bash
  • Shell Scripting
  • nginx
  • PHP-FPM
  • MySQL
Try it yourself
./bootstrap.sh --name=my-app

Free to use under its open-source licence. Issues and pull requests are welcome.

View on GitHub ↗
Next project 01 / 20 Food Delivery Online ordering for a village: customers browse local menus and pay online, while vendors update dishes and follow every order from kitchen to doorstep. Marketplace PHP Laravel 8 Blade Read the case study