Skip to content

CleatSquad/magento-frankenphp-template

Magento 2 Docker + FrankenPHP

Production-ready Docker environment for Magento 2 with FrankenPHP — the modern, high-performance PHP application server

FrankenPHP Logo

Docker Pulls Magento 2.4.x PHP Versions FrankenPHP 1.10 License MIT Version 1.0.0

About This Template

This repository is a GitHub template providing a ready-to-use Docker development and production environment for Magento 2 with FrankenPHP. Use it to bootstrap new Magento projects quickly with best practices for containerization.

Key Features

  • FrankenPHP — Modern PHP application server with Caddy
  • Automatic HTTPS — Built-in SSL via Caddy
  • Full Docker Stack — MariaDB, OpenSearch, Valkey, RabbitMQ, Mailhog
  • High Performance — OPcache optimized, ~2500 req/s
  • Dev Tools — Xdebug, CLI scripts, hot-reload ready

Links


Quick Start

Use as Template (Recommended)

  1. Click "Use this template" on GitHub to create your own repository
  2. Clone your new repository:
git clone https://github.com/YOUR_USERNAME/your-magento-project.git
cd your-magento-project

Clone Directly

# 1. Clone
git clone https://github.com/CleatSquad/magento-frankenphp-template.git
cd magento-frankenphp-template

# 2. Setup environment (copies env templates automatically)
./bin/setup

# 3. Start containers
./bin/start

# 4. Access https://magento.localhost

📁 Project Structure

Important: Place your Magento 2 source code in the src/ directory.

magento-frankenphp-template/
├── src/                    # 👈 Your Magento 2 code goes here
├── bin/                    # CLI tools
├── docker/                 # Docker configurations
├── docs/                   # Documentation
└── env/                    # Environment templates

Option A: Existing Magento Project

If you already have a Magento project, copy or clone it into the src/ directory:

# Copy existing project
cp -r /path/to/your/magento/* src/

# Or clone directly
git clone https://github.com/your-org/your-magento-repo.git src/

Option B: New Magento Installation

For a fresh Magento installation:

# 1. Start the containers
./bin/start

# 2. Enter the container and create Magento project
./bin/bash
composer create-project --repository-url=https://repo.magento.com/ \
    magento/project-community-edition .
exit

# 3. Run the interactive setup
./bin/setup-magento

The setup-magento script will guide you through the installation process, asking for admin credentials, language, currency, and timezone settings.

Quick Commands

make init        # Initialize and start (first time)
make up          # Start containers
make down        # Stop containers
make help        # Show all available commands

Features

  • PHP 8.2, 8.3, 8.4 — All Magento-required extensions included
  • Automatic HTTPS — Via Caddy web server
  • OPcache optimized — Pre-configured for best performance
  • Composer 2 — Latest version included
  • Xdebug ready — Pre-configured in dev images
  • Full stack included — MariaDB, OpenSearch, Valkey, RabbitMQ, Mailhog
  • CLI tools — Convenient scripts in bin/ directory

Documentation

Guide Description
Getting Started Installation and initial setup
CLI Tools All available commands
Configuration Environment variables and settings
Caddyfile Web server configuration
Xdebug Debugging with Xdebug
Production Production deployment
Local Dev Development environment setup
Kubernetes K8s deployment guide

Common Commands

./bin/start              # Start containers
make up                  # Start containers
./bin/stop               # Stop containers
./bin/magento cache:flush
./bin/bash               # Access app container shell
./bin/setup              # Initial setup
./bin/composer install
./bin/mysql              # Database CLI
make help                # Show all Makefile targets

See CLI Documentation for all commands.

Requirements

  • Docker >= 24.0
  • Docker Compose >= 2.20
  • Git

Contributing

See CONTRIBUTING.md for guidelines and CODE_OF_CONDUCT.md for community standards.

Security

See SECURITY.md for security policy and best practices.

License

MIT — see LICENSE