PHPackages                             waffle-commons/waffle - 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. waffle-commons/waffle

ActiveLibrary[Framework](/categories/framework)

waffle-commons/waffle
=====================

A modern, minimalist, and security-focused PHP micro-framework.

0.1.0-alpha4(4mo ago)132[6 PRs](https://github.com/waffle-commons/waffle/pulls)1MITPHPPHP ^8.5CI passing

Since Oct 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/waffle-commons/waffle)[ Packagist](https://packagist.org/packages/waffle-commons/waffle)[ RSS](/packages/waffle-commons-waffle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (13)Versions (16)Used By (1)

[![PHP Version Require](https://camo.githubusercontent.com/e741105aa9459daa0f9697aa60927fede3b93f0778738a647d63e56364e60765/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f776166666c652f726571756972652f706870)](https://packagist.org/packages/waffle-commons/waffle)[![PHP CI](https://github.com/waffle-commons/waffle/actions/workflows/main.yml/badge.svg)](https://github.com/waffle-commons/waffle/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/7986e8c58d2e557120b63d6d97ae4c9a2903a4ed91b15eba1d2c2bfb89feb8a3/68747470733a2f2f636f6465636f762e696f2f67682f776166666c652d636f6d6d6f6e732f776166666c652f67726170682f62616467652e7376673f746f6b656e3d64373461633632612d373837322d343033352d386238622d626363336166313939316530)](https://codecov.io/gh/waffle-commons/waffle)[![Latest Stable Version](https://camo.githubusercontent.com/7ff8ba34826ef7fd9261aadf19983e244eaecb90f3dbfe55dfe8037724070680/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f776166666c652f76)](https://packagist.org/packages/waffle-commons/waffle)[![Latest Unstable Version](https://camo.githubusercontent.com/8a629c1c566ef2e56c8d73846dbd182f471b64095fb8bd3fa83faa643e005e5c/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f776166666c652f762f756e737461626c65)](https://packagist.org/packages/waffle-commons/waffle)[![Total Downloads](https://camo.githubusercontent.com/9c57c532f97738204876f678145f8b4bc3fa3c9a0e4bb431abfa6cc603c0049f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776166666c652d636f6d6d6f6e732f776166666c652e737667)](https://packagist.org/packages/waffle-commons/waffle)[![Packagist License](https://camo.githubusercontent.com/3f69333d583c5526abb3c8c9f537edad5bc847effb9b52eb02a1c5057943894e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776166666c652d636f6d6d6f6e732f776166666c65)](https://github.com/waffle-commons/waffle/blob/main/LICENSE.md)

Waffle Framework
================

[](#waffle-framework)

A modern, minimalist, and security-focused PHP micro-framework designed for building fast and reliable JSON APIs. Waffle is built with the latest PHP features (8.4+) and follows PSR standards strictly.

Philosophy
----------

[](#philosophy)

Waffle is designed around a few core principles:

- **Modern PHP:** Leverages Attributes, Readonly properties, and strict typing.
- **Standards First:** Fully PSR-7 (HTTP Message), PSR-11 (Container), and PSR-17 (HTTP Factory) compliant.
- **Security by Design:** Integrated security layer analyzing code structure against configurable levels.
- **Decoupled Architecture:** The core logic is separated from infrastructure (HTTP, Container implementation), making it robust and testable.

Architecture
------------

[](#architecture)

Waffle adopts a modular architecture where the Core ("The Brain") is separated from the Runtime ("The Glue").

- **Waffle Core (`waffle-commons/waffle`):** Contains the Kernel, Router, Security Layer, and Abstract Controllers. It defines interfaces but does not implement the low-level plumbing.
- **Waffle Runtime (`waffle-commons/runtime`):** Handles the request lifecycle, connecting the HTTP layer and the Container to the Core.
- **Commons Components:** Standalone PSR implementations for `http` and `container`.

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

[](#getting-started)

### Installation

[](#installation)

The recommended way to start a new Waffle project is to install the Runtime, which pulls in the Core and necessary components.

```
composer require waffle-commons/runtime
```

### Directory Structure

[](#directory-structure)

A typical Waffle application structure (as managed in your workspace):

```
.
├── app/
│   ├── Controller/   # Your API Controllers
│   ├── Service/      # Business Logic Services
│   └── Kernel.php    # Your Application Kernel
├── config/
│   ├── app.yaml      # Main configuration
│   └── app_prod.yaml # Environment specific overrides
├── public/
│   └── index.php     # Entry point
└── composer.json

```

### Usage Example

[](#usage-example)

The Kernel now requires the Runtime component to start the request lifecycle.

**1. Create your Kernel (`app/Kernel.php`):**

```
namespace App;

use Waffle\Kernel as BaseKernel;

final class Kernel extends BaseKernel
{
    // Custom boot logic or service registration goes here
}
```

**2. Create a Controller (`app/Controller/HelloController.php`):**

```
namespace App\Controller;

use Waffle\Attribute\Route;
use Waffle\Core\BaseController;
use Waffle\Core\View;

#[Route('/hello', name: 'hello_')]
final class HelloController extends BaseController
{
    #[Route('/{name}', name: 'world')]
    public function world(string $name): View
    {
        return new View(data: ['message' => "Hello $name!"]);
    }
}
```

// 3. Entry Point (`public/index.php`) - Uses the Runtime:

```
use Waffle\Commons\Config\Config;
use Waffle\Commons\Container\Container;
use Waffle\Commons\Http\Emitter\ResponseEmitter;
use Waffle\Commons\Http\Factory\GlobalsFactory;
use Waffle\Commons\Runtime\WaffleRuntime;
use Waffle\Commons\Security\Security;
use App\Kernel;

require_once __DIR__ . '/../vendor/autoload.php';

define('APP_ROOT', dirname(__DIR__));

// 1. Setup Dependencies
$config = new Config(APP_ROOT . '/config', 'prod');
$security = new Security($config);
$container = new Container();

// 2. Setup Kernel
$kernel = new Kernel();
$kernel->setConfiguration($config);
$kernel->setSecurity($security);
$kernel->setContainerImplementation($container);

// 3. Create Request & Emitter
$request = (new GlobalsFactory())->createServerRequestFromGlobals();
$emitter = new ResponseEmitter();

// 4. Run via Runtime
$runtime = new WaffleRuntime();
$runtime->run($kernel, $request, $emitter);
```

Testing
-------

[](#testing)

To run the tests, use the following command:

```
composer tests
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for details.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE.md](./LICENSE.md) file for details.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance79

Regular maintenance activity

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

Every ~15 days

Total

6

Last Release

133d ago

PHP version history (2 changes)0.1.0-alpha1.0PHP ^8.4

0.1.0-alpha4PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/34a7557a3fb23aaf788ca3892b9b7efdf96e753264bafd0599153c9e8a921316?d=identicon)[LesliePetrimaux](/maintainers/LesliePetrimaux)

---

Top Contributors

[![supa-chayajin](https://avatars.githubusercontent.com/u/695448?v=4)](https://github.com/supa-chayajin "supa-chayajin (156 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/waffle-commons-waffle/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.3k86.3M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[windwalker/framework

The next generation PHP framework.

25639.1k1](/packages/windwalker-framework)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)

PHPackages © 2026

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