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 2mo 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 27% 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

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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