Search by

Application template for the Zephyrus PHP framework: Docker-ready with controllers, Latte views, database, sessions, and mailer preconfigured.

Package info

github.com/zephyrus-framework/project

Type:project

pkg:composer/zephyrus-framework/project

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-12-01 14:43 UTC

This package is auto-updated.

Last update: 2026-12-01 14:46:58 UTC


README

License: MIT

The official application template for the Zephyrus PHP framework. Start a new project with a working structure: controllers, Latte views, database, sessions, mailer, and Docker, all preconfigured.

Quick Start

You need Docker with Compose. Create the project one of two ways.

With PHP 8.4 or later (intl, mbstring and sodium extensions) and Composer on your machine:

composer create-project zephyrus-framework/project my-app

With Docker only, run the same command in the Zephyrus PHP image, as your own user:

docker run --rm -u "$(id -u):$(id -g)" -e COMPOSER_HOME=/tmp/composer -v "$PWD":/app -w /app ghcr.io/zephyrus-framework/php:8.6-dev composer create-project zephyrus-framework/project my-app

Either way, Composer installs the dependencies and creates .env with a fresh ENCRYPTION_KEY. Then start it:

cd my-app
docker compose up

Then open http://localhost:8080.

Port 8080 or 1080 already taken? Run APP_PORT=8081 MAIL_PORT=1081 docker compose up, or set APP_PORT and MAIL_PORT in .env.

Project Structure

app/
  Controllers/     Route controllers (auto-discovered via attributes)
  Models/          Domain models, services, brokers
  Views/           Latte templates
    layouts/       Layout templates
bin/
  create-env.php   Creates .env and its ENCRYPTION_KEY
cache/
  latte/           Compiled template cache (auto-generated)
config.yml         Application configuration (YAML with !env tag support)
locale/            Translation files (JSON)
public/            Web root (Apache document root)
  index.php        Application entry point
  assets/          Static assets (CSS, JS, images, fonts)
resources/
  css/app.css      Tailwind source of public/assets/css/app.css
sql/               Database initialization scripts
temp/              Temporary files

Styles

The views use Tailwind CSS through public/assets/css/app.css, a committed build of resources/css/app.css that holds only the classes found in app/Views/. After changing classes, rebuild it with the standalone Tailwind CLI v4.3.5 (no Node.js needed). Download it once into bin/, where Git ignores it; on macOS or an ARM machine, replace linux-x64 with macos-arm64, macos-x64 or linux-arm64; on Windows, run these commands in WSL:

curl -fsSLo bin/tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/v4.3.5/tailwindcss-linux-x64
chmod +x bin/tailwindcss
bin/tailwindcss -i resources/css/app.css -o public/assets/css/app.css --minify

While you edit views, add --watch to the last command: it rebuilds the stylesheet on every save.

Configuration

All configuration lives in config.yml. Sensitive values use the !env tag to reference environment variables from .env:

database:
  host: !env DB_HOST, localhost
  password: !env DB_PASSWORD

.env is not committed. On a fresh clone of your project, run composer install, then php bin/create-env.php: it copies .env.example to .env and generates the key. The example ships with working defaults for the Docker setup. With Docker only:

docker run --rm -u "$(id -u):$(id -g)" -e COMPOSER_HOME=/tmp/composer -v "$PWD":/app -w /app ghcr.io/zephyrus-framework/php:8.6-dev composer install
docker run --rm -u "$(id -u):$(id -g)" -v "$PWD":/app -w /app ghcr.io/zephyrus-framework/php:8.6-dev php bin/create-env.php

The example's values are for development: on a server, set APP_ENV=production and APP_DEBUG=false in .env. Without .env, config.yml falls back to production with debug off.

The body size limit (10 MB) is written in six places that must agree: security.max_body_size in config.yml; LimitRequestBody, post_max_size and upload_max_filesize in public/.htaccess; and the two -d options of php -S under Running Without Docker.

Docker Environment

The included docker-compose.yml runs the official postgres:17 image and ghcr.io/zephyrus-framework/php:8.6-dev (PHP 8.6 with Apache and MailCatcher), and provides:

Service Address Purpose
PHP/Apache 127.0.0.1:8080 Application server (PHP 8.6)
MailCatcher 127.0.0.1:1080 Email testing UI (SMTP on localhost:1025 inside the container)
PostgreSQL database:5432 Database (auto-initialized from sql/init.sql), reachable from the application only

Apache runs as www-data, which cannot write your files, so cache/latte/ and temp/ live in memory inside the container: they are emptied whenever it restarts.

To reach the database from a client on your machine, add a port under database in docker-compose.yml, then run docker compose up again:

    ports:
      - "127.0.0.1:5432:5432"

Common Commands

# Start the environment (Ctrl+C stops it)
docker compose up

# Run Composer inside the container, as your own user
docker compose exec -u "$(id -u):$(id -g)" -e COMPOSER_HOME=/tmp/composer webserver composer update

# Open a PostgreSQL shell
docker compose exec database psql -U dev zephyrus

# Reset the database (removes its volume, re-runs init.sql)
docker compose down -v
docker compose up

Running Without Docker

You need PHP 8.4+ with the intl, mbstring, pdo_pgsql and sodium extensions, and a PostgreSQL server. Set DB_HOST and the other DB_ values in .env to reach it, then:

php -d post_max_size=10M -d upload_max_filesize=10M -S 127.0.0.1:8080 -t public

The built-in server ignores public/.htaccess, so the two -d options set its body size limit. Under it, the debugger shows itself to your browser while DEBUG_CLIENTS is unset.

Controllers

Controllers use PHP 8 attributes for routing and are auto-discovered from app/Controllers/:

app/Controllers/ProductController.php:

<?php

declare(strict_types=1);

namespace App\Controllers;

use Zephyrus\Controller\Controller;
use Zephyrus\Http\Request;
use Zephyrus\Http\Response;
use Zephyrus\Rendering\RenderResponses;
use Zephyrus\Routing\Attribute\Get;
use Zephyrus\Routing\Attribute\Post;

final class ProductController extends Controller
{
    use RenderResponses;

    #[Get('/products')]
    public function index(): Response
    {
        return $this->render('products/index', [
            'products' => [],
        ]);
    }

    #[Post('/products')]
    public function store(Request $request): Response
    {
        $data = $request->body()->all();
        // ...
        return Response::redirect('/products');
    }
}

app/Views/products/index.latte, the view it renders:

{layout '../layouts/main.latte'}

{block title}Products{/block}

{block content}
<form method="post" action="/products">
    <input type="hidden" name="_csrf_token" value="{csrfToken()}">
    <button>Save</button>
</form>
{/block}

No manual route registration needed: create a controller in app/Controllers/ and add route attributes.

Every request but GET, HEAD and OPTIONS must carry the CSRF token, in the _csrf_token field (as in the form above) or the X-CSRF-Token header, or it gets a 403.

When a Page Fails

Under Docker, an error answers a bare 500 Internal Server Error. Its message is in the output of docker compose up (or docker compose logs webserver), one long line among the request lines. To list only the lines PHP wrote:

docker compose logs webserver | grep -F '[php:'

An exception in your code shows as Zephyrus: unhandled exception, answered with a 500. A malformed DEBUG_CLIENTS (a secret shorter than 16 characters, a range, an @ with no secret before it) makes every page answer 500: its line, a PHP Fatal error, names the entry and what is wrong with it.

To see the debugger in your browser instead:

  1. Find the address your browser comes from: it starts each request line of that output, like 172.23.0.1 in webserver-1 | 172.23.0.1 - - [...] "GET / HTTP/1.1" 200. It can change after docker compose down.
  2. Make a secret with docker compose exec webserver php -r 'echo bin2hex(random_bytes(16)), "\n";'.
  3. Set DEBUG_CLIENTS=<secret>@<address> in .env. In the browser console, run document.cookie = "tracy-debug=<secret>; path=/", then reload the page.

Documentation

The framework documentation is at zephyrus.ophelios.com. See the core framework README for API details.

License

MIT, see LICENSE.