The PHP Framework
for Modern Web
A lightweight PHP framework with a built-in CMS, AI page builder, marketplace, and modular architecture. No bloat, just what you need.
Built for Modern PHP
Everything you need to build production-ready applications
CMS & Admin Panel
Full content management with dashboard, page builder, media library, theme customizer, and user management.
AI Page Builder
Generate pages, sections, and content with AI. Supports Gemini, Claude, OpenAI, Groq, Mistral, and more.
Marketplace
Browse and install themes, apps, sections, and starters. Build and publish your own extensions.
Routing
Define expressive routes with closures, controllers, named routes, and middleware chains.
Security
Built-in CSRF protection, Content Security Policy, input sanitization, and secure headers.
Database
Powered by Doctrine ORM with models, migrations, and a fluent query builder.
Twig Templates
Twig templating with layouts, components, automatic escaping, and custom helpers.
Craftsman CLI
Generate controllers, models, routes, and manage modules from the terminal.
Modular Architecture
Install only what you need — auth, database, cache, API, CMS. Each module is a separate package.
See It In Action
Expressive, clean code for every layer of your application
Routing
Define clean, expressive routes with closures and controllers
Controllers
Organize application logic in clean controller classes
Database
Fluent query builder and Doctrine ORM integration
Assets
CDN, versioning, SRI hashes, and asset bundling
Middleware
Filter and protect routes with custom middleware
<?php
use ZephyrPHP\Router\Route;
use App\Controllers\UserController;
// Simple route with closure
Route::get('/', function () {
return view('welcome');
});
// Controller-based routes
Route::get('/users', [UserController::class, 'index']);
Route::post('/users', [UserController::class, 'store']);
Route::get('/users/{id}', [UserController::class, 'show']);
// Named route with method chaining
Route::get('/dashboard', [DashboardController::class, 'index'])
->name('dashboard')
->middleware('auth');
<?php
namespace App\Controllers;
use ZephyrPHP\Core\Controllers\Controller;
use App\Models\User;
class UserController extends Controller
{
public function index()
{
$users = User::query()
->where('active', '=', true)
->orderBy('name')
->paginate(15);
return $this->render('users/index', [
'users' => $users
]);
}
public function store()
{
$data = $this->validate([
'name' => 'required|min:3',
'email' => 'required|email',
]);
$user = new User();
$user->fill($data)->save();
$this->flash('success', 'User created!');
return $this->redirect('/users');
}
}
<?php
namespace App\Models;
use ZephyrPHP\Database\Model; // zephyrphp/database module
class Post extends Model
{
protected string $table = 'posts';
protected array $fillable = [
'title', 'slug', 'content', 'published'
];
}
// Fluent query builder
$posts = Post::query()
->where('published', '=', true)
->where('created_at', '>', '2024-01-01')
->orderBy('created_at', 'DESC')
->limit(10)
->get();
// Create with mass assignment
$post = Post::create([
'title' => 'Hello World',
'slug' => 'hello-world',
'content' => 'My first post',
]);
// config/assets.php — Define asset collections
return [
'version_strategy' => 'timestamp',
'cdn_url' => 'https://cdn.example.com',
'collections' => [
'core' => [
['path' => 'assets/css/app.css', 'priority' => 1],
['path' => 'assets/js/app.js', 'priority' => 10],
],
],
];
{# In your Twig template #}
{{ load_assets('core') }}
{{ render_css() }} {# Auto-versioned <link> tags #}
{{ render_js() }} {# Deferred <script> tags #}
{# CDN + SRI support out of the box #}
{{ asset_url('images/hero.webp') }}
{# → https://cdn.example.com/images/hero.webp?v=a1b2c3 #}
<?php
namespace App\Middleware;
use ZephyrPHP\Core\Http\Request;
use ZephyrPHP\Middleware\MiddlewareInterface;
class AuthMiddleware implements MiddlewareInterface
{
public function handle(
$request,
callable $next
) {
if (!session('user_id')) {
return redirect('/login');
}
return $next($request);
}
}
// Apply middleware to routes
Route::get('/dashboard', [DashboardController::class, 'index'])
->middleware(AuthMiddleware::class);
Quick Start
Get up and running in 3 simple steps
Install via Composer
composer create-project zephyrphp/starter myapp
Configure Environment
cp .env.example .env
php craftsman key:generate
Start Development Server
php craftsman serve
The ZephyrPHP Ecosystem
A modular platform — install only what you need
Database
Doctrine ORM, migrations, query builder
composer require zephyrphp/database
Authentication
Session & JWT auth, guards, providers
composer require zephyrphp/auth
API Toolkit
REST resources, CORS, rate limiting
composer require zephyrphp/api
CMS
Admin panel, themes, AI builder, media
composer require zephyrphp/cms
Cache
File, Redis, APCu drivers with TTL
composer require zephyrphp/cache
Authorization
Gates, policies, RBAC permissions
composer require zephyrphp/authorization
Ready to build something amazing?
Join developers who choose simplicity, performance, and a powerful ecosystem.