Skip to content

rdurica/php_starter_kit

Repository files navigation

PHP Starter Kit

Modern Docker-based starter kit for PHP applications built on FrankenPHP — a Caddy-powered PHP server with HTTP/2, HTTP/3, and automatic HTTPS.

PHP FrankenPHP Docker Tests License

Banner

Setup Wizard Installation Progress Installation Complete

Table of Contents

Quick Start

git clone https://github.com/rdurica/php_starter_kit.git && cd php_starter_kit && make init

Then open https://localhost (auto-generated certificate) and select your framework from the setup wizard.


Overview

This starter kit provides a ready-to-use, out-of-the-box local development environment for modern PHP projects. It comes preconfigured with everything you need to start coding immediately, without wasting time on setup and configuration.

Key aspects:

  • FrankenPHP — Modern PHP application server with HTTP/2, HTTP/3, and automatic HTTPS
  • Secure by default — Non-root user, security headers, hardened sessions, no expose_php
  • Multi-environment — Dev and CI configurations
  • Multi-stage production build — Minimal attack surface, optimized layers
  • CI/CD ready — GitHub Actions with code quality, tests, security scanning
  • DevContainer support — VSCode remote containers out of the box
  • One-click framework installer — Web-based setup wizard for Laravel, Symfony, and Nette
  • Frontend ready — Node.js and Vite integrated in the dev container

Requirements

  • Docker & Docker Compose
  • Make (optional but recommended)
  • sudo access for trusting local HTTPS certificates

Available Commands

Common development tasks are automated via make. These commands manage the Docker containers and development workflow.

Command Description
make init First-time setup: network, images, containers
make up Start containers in detached mode
make down Stop and remove containers
make logs Show live logs from all containers
make php Open shell inside the FrankenPHP container
make rebuild Force rebuild images (--pull --no-cache)
make reload Rebuild images with cache
make setup-githooks Enable pre-commit hooks
make trust-cert Trust Caddy's local CA certificate

Framework Installation

After running make init, open https://localhost. The setup wizard will present three framework options:

Framework Description
Symfony Robust architecture with reusable components
Laravel Expressive syntax and rich ecosystem
Nette Security-focused, Czech-made framework

Click your chosen framework and confirm the installation. The wizard will:

  1. Download and install the framework via Composer
  2. Display real-time progress and terminal output
  3. Move files into place automatically (including Nette's www/public/ migration)
  4. Back up the landing page to /setup.php

After installation, you can delete /setup.php via the success dialog or manually:

Environments

Development (compose.yaml)

  • FrankenPHP with xdebug, Node.js, Git, Symfony CLI, Laravel installer
  • Caddy auto HTTPS on https://localhost
  • Vite dev server running in the background
  • Volume mount for live code editing

CI (compose.ci.yaml)

  • Lightweight FrankenPHP image (no xdebug, no Node)
  • SQLite in-memory for fast tests
  • Ideal for GitHub Actions

Production

Build the production image:

docker build -f build/prod/Dockerfile -t myapp:latest .

CI/CD

Three GitHub Actions workflows are included:

Workflow Description
code-quality.yml PHPStan, PHP CS Fixer, Composer audit, Frontend lint
ci.yml Framework auto-detection, PHPUnit tests, Docker lint
build.yml Multi-stage prod image build, GHCR push, Trivy security scan

License

This project is licensed under the terms of the MIT license.

About

Batteries included docker template for building PHP applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors