PHPackages                             zenithframework/framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. zenithframework/framework

ActiveProject[Framework](/categories/framework)

zenithframework/framework
=========================

A clean, modern, backend-first PHP framework with built-in dynamic UI

v3.0.0(2mo ago)101[2 PRs](https://github.com/zenithframework/zenithframework/pulls)MITPHPPHP ^8.5

Since Apr 6Pushed 2mo agoCompare

[ Source](https://github.com/zenithframework/zenithframework)[ Packagist](https://packagist.org/packages/zenithframework/framework)[ RSS](/packages/zenithframework-framework/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (6)Used By (0)

Zenith Framework v3.0 Enterprise
================================

[](#zenith-framework-v30-enterprise)

> **World-Class PHP 8.5+ Framework** - Clean, Modern, Backend-First

A clean, modern, backend-first PHP framework with built-in dynamic UI system, strict routing architecture, enterprise-grade security, and **native SSE support**.

**Version:** 3.0.0 "Enterprise"
**PHP Requirement:** 8.5+
**Release Date:** April 9, 2026
**Website:** [zenithframework.com](https://zenithframework.com)

🌟 Why Zen?
----------

[](#-why-zen)

✅ **Native SSE Support** - Real-time streaming without WebSockets complexity
✅ **PHP 8.5 Attributes** - Clean, inline route definitions
✅ **AI Ready** - Built-in OpenAI, Anthropic, Ollama integration
✅ **HTMX Support** - First-class Actions system
✅ **Modern ORM** - 10 relationship types, observers, soft deletes
✅ **Queue System** - Sync, Database, Redis drivers
✅ **Mail System** - SMTP, Sendmail, Log drivers
✅ **File Storage** - Local, S3, FTP support
✅ **Task Scheduler** - Cron-like scheduling DSL
✅ **Authorization** - Gates and Policies
✅ **Security** - WAF, DDoS protection, rate limiting
✅ **118 CLI Commands** - Complete development toolkit
✅ **Clean Architecture** - Predictable, no magic
✅ **Comprehensive Docs** - Complete syntax and CLI guides

Features
--------

[](#features)

### Template Engine

[](#template-engine)

- **Layout Inheritance** - `@extends`, `@section`, `@yield`
- **Directives** - `@if`, `@else`, `@foreach`, `@for`, `@while`
- **Components** - ``, `` with slots
- **Template Caching** - Compiled templates cached in production

### Performance

[](#performance)

- **Multi-Level Cache** - Memory → APCu → Redis
- **Advanced Rate Limiting** - TokenBucket, LeakyBucket, SlidingWindow
- **Server Support** - Swoole, Workerman, RoadRunner adapters
- **Connection Pooling** - Pre-connected database sockets

### Real-time

[](#real-time)

- **WebSocket** - Full-duplex communication with rooms
- **SSE** - Server-Sent Events support
- **Connection Pooling** - Manage multiple connections

### Clustering

[](#clustering)

- **Load Balancer** - Round-robin, least connections, weighted, IP hash
- **Health Checker** - Node monitoring
- **Failover** - Automatic failover
- **Service Discovery** - Dynamic registration

### Security (Enterprise-Grade)

[](#security-enterprise-grade)

- **WAF** - Rule-based web application firewall
- **DDoS Protection** - Traffic analysis, JS challenge, CAPTCHA
- **IP Blocking** - Auto-ban, CIDR, geo-blocking, ASN filtering
- **Rate Limiting** - Per-user, per-IP, quota management
- **CSRF Protection** - Token-based form protection
- **Encryption** - AES-256-GCM, HMAC support
- **Two-Factor Auth** - TOTP (Google Authenticator)

### Resilience

[](#resilience)

- **Circuit Breaker** - Failure isolation
- **Retry Policy** - Exponential backoff
- **Timeout Handler** - Request timeouts
- **Bulkhead** - Resource isolation

### Core Framework

[](#core-framework)

- **Clean &amp; Minimal** - No architectural confusion, zero garbage code
- **Backend-First** - API-first design with JSON responses
- **Strict Routing** - Separate route files for Web, API, Auth, and AI
- **Attribute Routing** - PHP 8.5+ attributes for inline route definitions
- **Built-in UI System** - Components, Pages, and Layouts
- **HTMX-Style Updates** - Server-side rendering with dynamic DOM updates
- **ORM System** - Model, QueryBuilder, and Builder
- **Soft Deletes** - Automatic trash and restore functionality
- **Model Observers** - Hook into model lifecycle events
- **Session &amp; Auth** - Complete authentication system
- **Authorization** - Gates and Policies for fine-grained access control
- **Validation** - 40+ built-in validation rules
- **Cache System** - File, Array, APCu, Redis drivers
- **Queue System** - Sync, Database, Redis drivers
- **Mail System** - SMTP, Sendmail, Log drivers
- **File Storage** - Local, S3, FTP drivers
- **Task Scheduler** - Cron-like scheduling with fluent DSL
- **SSE Support** - Native Server-Sent Events for real-time streaming
- **AI Integration** - OpenAI, Anthropic, and Ollama support

### CLI Tools

[](#cli-tools)

- **40+ Commands** - make, remove, rename, migrate, seed, serve, test, lint

Requirements
------------

[](#requirements)

- PHP 8.5+
- PDO Extension
- OpenSSL Extension
- cURL Extension
- MBString Extension

Quick Start
-----------

[](#quick-start)

```
# Create new project
composer create-project zanith/framework my-project
cd my-project

# Copy environment file
cp .env.example .env

# Run migrations
php zen migrate

# Start development server
php zen serve

# Check version
php zen -v
```

Quick Examples
--------------

[](#quick-examples)

### Attribute-Based Routing (PHP 8.5+)

[](#attribute-based-routing-php-85)

```
#[Prefix('/users')]
#[Middleware(['auth'])]
class UserController
{
    #[Get('/', name: 'users.index')]
    public function index(): Response
    {
        return view('users.index', ['users' => User::all()]);
    }

    #[Post('/', middleware: ['csrf'])]
    public function store(Request $request): Response
    {
        $user = User::create($request->validated());
        return redirect()->route('users.show', ['id' => $user->id]);
    }
}
```

### Server-Sent Events (Real-Time Streaming)

[](#server-sent-events-real-time-streaming)

```
#[Get('/chat/{roomId}/stream')]
public function stream(Request $request, int $roomId): StreamingResponse
{
    return new StreamingResponse(
        new SseStream(
            dataProvider: fn($lastId) => $this->getNewMessages($roomId, $lastId),
            pollInterval: 1,
            heartbeatInterval: 15,
            timeout: 1800
        )
    );
}
```

### Soft Deletes

[](#soft-deletes)

```
class User extends Model
{
    use SoftDeletes;
}

// Soft delete
$user->delete();

// Restore
$user->restore();

// Include trashed
$users = User::withTrashed()->get();
```

### Model Observers

[](#model-observers)

```
class PostObserver extends Observer
{
    public function creating(Post $post): void
    {
        $post->slug = str($post->title)->slug();
    }

    public function created(Post $post): void
    {
        event(new PostCreated($post));
    }
}

// Register
Post::observe(PostObserver::class);
```

### Authorization (Gates &amp; Policies)

[](#authorization-gates--policies)

```
// Define gate
Gate::define('update-post', function ($user, $post) {
    return $user->id === $post->user_id;
});

// Check gate
if (Gate::allows('update-post', $post)) {
    // User can update
}

// In controller
$this->authorizeAbility('update', $post);
```

### Task Scheduler

[](#task-scheduler)

```
// In Console Kernel
$scheduler->command('cache:clear')
    ->hourly()
    ->withoutOverlapping();

$scheduler->command('db:backup')
    ->dailyAt('2:00')
    ->onOneServer();
```

Directory Structure
-------------------

[](#directory-structure)

```
zen/
├── app/
│   ├── Http/Controllers/
│   ├── Http/Middleware/
│   ├── Http/Requests/
│   ├── Models/
│   ├── Pages/
│   ├── Services/
│   ├── Providers/
│   └── UI/Components/
├── boot/           # Startup system
├── config/         # Configuration
├── core/           # Framework engine
├── database/       # Migrations, Seeders, Factories
├── routes/         # Route definitions
├── views/          # Views and layouts
└── zen            # CLI entry point

```

Routing
-------

[](#routing)

Routes are organized by domain in `routes/`:

- `Web.php` - Public web routes (UI/pages)
- `Api.php` - API routes (JSON)
- `Auth.php` - Authentication routes
- `Ai.php` - AI-related routes

CLI Commands
------------

[](#cli-commands)

### Make Commands

[](#make-commands)

```
php zen make:model User
php zen make:controller UserController
php zen make:migration create_users_table
php zen make:seeder UserSeeder
php zen make:factory UserFactory
php zen make:layout dashboard --type=app
php zen make:middleware Auth
php zen make:request StoreUser
php zen make:job ProcessOrder
php zen make:event UserRegistered
php zen make:listener SendWelcomeEmail
```

### Remove Commands

[](#remove-commands)

```
php zen remove:model User
php zen remove:controller UserController
php zen remove:migration create_users_table
php zen remove:seeder UserSeeder
```

### Database Commands

[](#database-commands)

```
php zen migrate
php zen migrate --rollback
php zen migrate --reset
php zen db:seed
```

### Other Commands

[](#other-commands)

```
php zen route:list
php zen cache:clear
php zen serve
php zen lint
php zen test
```

Configuration
-------------

[](#configuration)

Edit `.env` for configuration:

```
APP_NAME=Zenith Framework
APP_ENV=development
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=sqlite
DB_DATABASE=database/database.sqlite

CACHE_DRIVER=file
AI_API_KEY=your-api-key
```

Documentation
-------------

[](#documentation)

- [**Official Website**](https://zenithframework.com) - 🌐 **Complete documentation and guides**
- [**SYNTAX.md**](./SYNTAX.md) - 📖 **Complete syntax guide** - START HERE
- [**CLI\_COMMANDS.md**](./CLI_COMMANDS.md) - 🛠️ **118 CLI commands reference**
- [**SSR\_GUIDE.md**](./SSR_GUIDE.md) - ⚡ **SSR engine guide**
- [**SSR\_ISR\_SSE\_GUIDE.md**](./SSR_ISR_SSE_GUIDE.md) - 🚀 **SSR, ISR, and SSE comprehensive guide**
- [**GUIDE.md**](./GUIDE.md) - Full tutorial
- [**SECURITY.md**](./SECURITY.md) - Security policy and best practices
- [**SKILLS.md**](./SKILLS.md) - Complete developer reference
- [**AGENTS.md**](./AGENTS.md) - AI agent instructions
- [**CHANGELOG.md**](./CHANGELOG.md) - Version history
- [**CONTRIBUTING.md**](./CONTRIBUTING.md) - Contribution guidelines

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance88

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

61d ago

Major Versions

v1.0.0 → v2.0.02026-04-07

1.0.x-dev → 2.0.x-dev2026-04-09

2.0.x-dev → v3.0.02026-04-09

PHP version history (2 changes)v1.0.0PHP ^8.4

2.0.x-devPHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/301756e67a95b8dab63bfb0de65f6166b539e25b9c30a160bf65574c0843f1e7?d=identicon)[zenithframework](/maintainers/zenithframework)

### Embed Badge

![Health badge](/badges/zenithframework-framework/health.svg)

```
[![Health](https://phpackages.com/badges/zenithframework-framework/health.svg)](https://phpackages.com/packages/zenithframework-framework)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M822](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[pinguo/php-msf

Pinguo Micro Service Framework For PHP

1.7k4.2k](/packages/pinguo-php-msf)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
