PHPackages                             zephyrus-framework/core - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. zephyrus-framework/core

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

zephyrus-framework/core
=======================

Cohesive PHP 8.4+ framework — attribute routing, immutable HTTP, typed config, and security middleware out of the box.

v0.9.0(1mo ago)02↓100%MITPHPPHP ^8.4CI passing

Since Mar 20Pushed 1mo agoCompare

[ Source](https://github.com/zephyrus-framework/core)[ Packagist](https://packagist.org/packages/zephyrus-framework/core)[ RSS](/packages/zephyrus-framework-core/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Zephyrus
========

[](#zephyrus)

[![CI](https://github.com/zephyrus-framework/core/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/zephyrus-framework/core/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/e6c06c69d51407fcfc96c60adb924667ac13ba07d2808773137c8932535ff8f3/68747470733a2f2f636f6465636f762e696f2f67682f7a657068797275732d6672616d65776f726b2f636f72652f67726170682f62616467652e737667)](https://codecov.io/gh/zephyrus-framework/core)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A cohesive PHP 8.4+ framework core. Attribute-based routing, immutable HTTP objects, typed configuration, and a full security middleware stack — with ~98% test coverage throughout.

---

Getting Started
---------------

[](#getting-started)

The fastest way to start a new project is the official application template:

```
composer create-project zephyrus-framework/framework my-app
cd my-app
composer dev
```

This gives you a working application structure with controllers, views, config, and a dev server ready to go.

To use the core library directly in an existing project:

```
composer require zephyrus-framework/core
```

---

Overview
--------

[](#overview)

### Routing

[](#routing)

Define routes with PHP 8 attributes directly on controller methods:

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

class UserController extends Controller
{
    #[Get('/users')]
    public function index(): Response
    {
        return Response::json(['users' => []]);
    }

    #[Get('/users/{id}')]
    public function show(int $id): Response
    {
        return Response::json(['id' => $id]);
    }

    #[Post('/users')]
    public function store(Request $request): Response
    {
        $data = $request->body()->all();
        return Response::json(['created' => true], 201);
    }
}
```

Available verb attributes: `#[Get]`, `#[Post]`, `#[Put]`, `#[Patch]`, `#[Delete]`, `#[Head]`, `#[Options]`.

Route parameters are injected by name with automatic type coercion. A type mismatch (e.g. `"abc"` for `int $id`) returns a 404.

#### Route Prefixing

[](#route-prefixing)

Use `#[Root]` to apply a URL prefix to an entire controller. It supports inheritance — child controller prefixes are appended to parent prefixes:

```
#[Root('/admin')]
class AdminController extends Controller {}

#[Root('/users')]
class AdminUserController extends AdminController
{
    #[Get('/list')]  // resolves to /admin/users/list
    public function list(): Response { ... }
}
```

#### Auto-Discovery

[](#auto-discovery)

Instead of registering controllers one by one, scan a directory:

```
$router->discoverControllers('App\\Controllers', 'app/Controllers/');
```

### Middleware

[](#middleware)

Implement `MiddlewareInterface` and register globally or on specific routes:

```
use Zephyrus\Http\MiddlewareInterface;
use Zephyrus\Http\Request;
use Zephyrus\Http\Response;

class AuthMiddleware implements MiddlewareInterface
{
    public function process(Request $request, callable $next): Response
    {
        if ($request->headers()->bearerToken() === null) {
            return Response::json(['error' => 'Unauthorized'], 401);
        }
        return $next($request);
    }
}
```

Register globally on the kernel, or as a named middleware for use in route attributes:

```
#[Middleware('auth')]
#[Get('/account')]
public function account(): Response { ... }
```

### Request

[](#request)

The `Request` object is immutable and composed of typed sub-objects:

```
$request->uri()      // scheme, host, path, query string
$request->body()     // POST/JSON body — get(key), all(), has(key)
$request->headers()  // HeaderBag — get(name), bearerToken(), isJson()
$request->cookies()  // CookieJar — get(name), all()
$request->query      // query string parameters (array)
$request->files      // uploaded files
```

### Response

[](#response)

```
Response::json(['key' => 'value']);
Response::json($data, 201);
Response::redirect('/login');
Response::html('Hello');
Response::plain('OK');
```

Responses are immutable — `withHeader()`, `withStatus()`, and `withBody()` return new instances.

### Validation

[](#validation)

```
use Zephyrus\Validation\FormValidator;
use Zephyrus\Validation\Rules;

$form = new FormValidator([
    'email' => [Rules::required(), Rules::email()],
    'name'  => [Rules::required(), Rules::name()],
    'bio'   => [Rules::maxLength(500)],  // optional — skipped when empty
]);

// In a controller (throws ValidationException → auto 422):
$this->validate($form, $request->body()->all());
```

### Bootstrap

[](#bootstrap)

Wire everything together once at startup:

```
use Zephyrus\Core\KernelBuilder;
use Zephyrus\Http\Request;
use Zephyrus\Routing\Router;

$router = (new Router())
    ->discoverControllers('App\\Controllers', 'app/Controllers/');

$kernel = KernelBuilder::create()
    ->withRouter($router)
    ->withMiddleware(new CsrfMiddleware())
    ->withMiddleware(new SecureHeadersMiddleware())
    ->build();

$request  = Request::fromGlobals();
$response = $kernel->handle($request);
$response->send();
```

---

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

[](#requirements)

RequirementVersionPHP`^8.4`Extensions`mbstring`, `pdo`, `intl`, `sodium`Runtime dependencies: `symfony/yaml`, `vlucas/phpdotenv`, `latte/latte`, `tracy/tracy`, `phpmailer/phpmailer`.

---

Development
-----------

[](#development)

```
git clone https://github.com/zephyrus-framework/core zephyrus-core
cd zephyrus-core
composer install
```

Run the test suite:

```
composer test
# or without coverage instrumentation:
php vendor/bin/phpunit --no-coverage
```

Run with coverage (requires Xdebug):

```
XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text
```

The project targets ~98% coverage. Every change should come with tests.

---

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

[](#documentation)

Full documentation — including guides for sessions, security, validation, database access, localization, file uploads, events, mailer, and more — is available on the docs site (coming soon).

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance96

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9836ecddefbfb98dabec6f172e87e6735aeb9bd9798a9d84d4b655e65f144daf?d=identicon)[ophelios](/maintainers/ophelios)

---

Top Contributors

[![dadajuice](https://avatars.githubusercontent.com/u/4491532?v=4)](https://github.com/dadajuice "dadajuice (350 commits)")

---

Tags

attribute-routingdependency-injectionhttplattelocalizationmvcpdophpphp-frameworksecurityvalidation

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)[getkirby/cms

The Kirby core

1.5k535.5k350](/packages/getkirby-cms)[drupal/coder

Coder is a library to review Drupal code.

3043.6M459](/packages/drupal-coder)[tomaj/nette-api

Nette api

36261.8k4](/packages/tomaj-nette-api)[kdyby/html-validator-panel

Nette DebugBar panel for validating the output HTML.

1034.6k3](/packages/kdyby-html-validator-panel)

PHPackages © 2026

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