PHPackages                             ww/damascus - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. ww/damascus

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ww/damascus
===========

A middlewares library

0770[1 PRs](https://github.com/wolfwolker/Damascus/pulls)PHP

Since Jan 19Pushed 3y ago3 watchersCompare

[ Source](https://github.com/wolfwolker/Damascus)[ Packagist](https://packagist.org/packages/ww/damascus)[ RSS](/packages/ww-damascus/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Damascus
========

[](#damascus)

A simple middlewares implementation in php. Like Damascus Steel, this is about layers

Installation
------------

[](#installation)

```
composer require ww/damascus

```

Basic Usage
-----------

[](#basic-usage)

### 1. Create Middlewares

[](#1-create-middlewares)

```
class IncFooMiddleware implements Damascus\MiddlewareInterface
{
    public function run(Damascus\DataBucketInterface $dataBucket, MiddlewareStep $next)
    {
        $dataBucket['foo'] += rand(0,12);

        if ($dataBucket['foo'] < 10) {
            $next->run($dataBucket);
        }
    }
}

class MailerMiddleware implements Damascus\MiddlewareInterface
{
    private $mailer;

    //I'm not coding the constructor of this

    public function run(Damascus\DataBucketInterface $dataBucket, MiddlewareStep $next)
    {
        $this->mailer->send($dataBucket['from'], $dataBucket['to'], $dataBucket['subject'], $dataBucket['body']);
    }
}

```

### 2. Push middlewares to a stack

[](#2-push-middlewares-to-a-stack)

```
$middleware = ;
$stack = (new Damascus\MiddlewareStack())
    ->pushMiddleware(new IncFooMiddleware())
    ->pushMiddleware(new MailerMiddleware());

```

### 3. Start the forgery

[](#3-start-the-forgery)

```
$dataBucket = new Damascus\DataBucket([
    'from' => 'asdf@gmail.com',
    'to' => 'asdf@gmail.com',
    'subject' => 'threshold 10 not reached',
    'body' => 'threshold 10 not reached',
    'foo' => 0,
]);

$stack->run($dataBucket);

```

Advanced topics
---------------

[](#advanced-topics)

- Create so many middlewares as you need. You can use DIC to reuse them and to add them dependencies.
- You can use DIC also to reuse a middlewares stack.
- You can create your custom DataBucketInterface as you want with the data you need, and ensure is the right one in your middlewares.

Future
------

[](#future)

I would like to create in a near future a Symfony bundle for this, allowing, using DIC tags to automatically generate middleware stacks.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78a96747f18e52b416f46e619e6732a38aa2520583848110898707569edc0fee?d=identicon)[wolfwolker](/maintainers/wolfwolker)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ww-damascus/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M81](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.7k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M89](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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