PHPackages                             benycode/slim-request-deserialize - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. benycode/slim-request-deserialize

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

benycode/slim-request-deserialize
=================================

Deserialize slim 4 requests with the Symfony Serializer

v1.3.1(2y ago)021PHPPHP ^8.0

Since Feb 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/benycode/slim-request-deserialize)[ Packagist](https://packagist.org/packages/benycode/slim-request-deserialize)[ RSS](/packages/benycode-slim-request-deserialize/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (4)Versions (8)Used By (0)

Slim 4 request middleware deserialize
=====================================

[](#slim-4-request-middleware-deserialize)

Deserialize Slim 4 requests with the Symfony Serializer

Table of contents
-----------------

[](#table-of-contents)

- [Install](#install)
- [Usage](#usage)

Install
-------

[](#install)

Via Composer

```
$ composer require benycode/slim-request-deserialize
```

Requires Slim 4.

Usage
-----

[](#usage)

create an entity class:

```
declare(strict_types=1);

namespace App;

final class RequestData
{
    public string $username;

    public string $loginId;

    public string $publicKey;

    public function setUsername(string $username): self
    {
        $this->username = $username;
	return $this;
    }

    public function getUsername(): ?string
    {
        return $this
	    ->username
	;
    }

    public function setLoginId(string $loginId): self
    {
        $this->loginId = $loginId;
	return $this;
    }

    public function getLoginId(): ?string
    {
	return $this
	    ->loginId
        ;
    }

    public function setPublicKey(string $publicKey): self
    {
	$this->publicKey = $publicKey;
	return $this;
    }

    public function getPublicKey(): ?string
    {
	return $this
	    ->publicKey
        ;
    }
}
```

add a Middlewares to route:

```
use BenyCode\Slim\RequestDeserialize\RequestDeserializeMiddleware;
use Symfony\Component\Serializer\Encoder\JsonEncoder as DeserializeEncoder;
use App\RequestData;

$app = new \Slim\App();

$app->post('/api/any_end_point',function ($req, $res, $args) {

})
->add(new RequestDeserializeMiddleware([
    RequestData::class,
    DeserializeEncoder::FORMAT, // json encoder, but you can choice xml, yaml, csv
]))
;

$app->run();
```

use your deserialized data:

```
...
public function __invoke(
    ServerRequestInterface $request,
    ResponseInterface $response
): ResponseInterface {
    $requestData = $request
        ->getAttribute('request_data')
    ;

    $requestData->getUsername(); // get the username
    $requestData->getLoginId(); // get the login id
    ...
}
...
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~72 days

Recently: every ~99 days

Total

7

Last Release

810d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39025147?v=4)[Benediktas Rukas](/maintainers/benycode)[@benycode](https://github.com/benycode)

---

Top Contributors

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

---

Tags

requestmiddlewaresymfonyserializerslim 4

### Embed Badge

![Health badge](/badges/benycode-slim-request-deserialize/health.svg)

```
[![Health](https://phpackages.com/badges/benycode-slim-request-deserialize/health.svg)](https://phpackages.com/packages/benycode-slim-request-deserialize)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

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