PHPackages                             brendt/php-make-object - 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. brendt/php-make-object

ActiveLibrary

brendt/php-make-object
======================

Simple wrapper for symfony/serializer for the 90% use-case

0.5.0(3y ago)149[3 PRs](https://github.com/brendt/php-make-object/pulls)MITPHPPHP ^8.1

Since Dec 1Pushed 2y ago2 watchersCompare

[ Source](https://github.com/brendt/php-make-object)[ Packagist](https://packagist.org/packages/brendt/php-make-object)[ Docs](https://github.com/brendt/php-make-object)[ GitHub Sponsors](https://github.com/brendt)[ RSS](/packages/brendt-php-make-object/feed)WikiDiscussions main Synced 1mo ago

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

Simple wrapper for symfony/serializer for the 90% use-case
==========================================================

[](#simple-wrapper-for-symfonyserializer-for-the-90-use-case)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2117c35b8dedbd07509c70a2afccc795239c8376bcb4656aac926de214e4da8c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6272656e64742f7068702d6d616b652d6f626a6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brendt/php-make-object)[![Tests](https://github.com/brendt/php-make-object/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/brendt/php-make-object/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/aeae7bab6d62008ca65fa58a98e9a3f260573cbb164efecfe58ee5c52f7e204a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6272656e64742f7068702d6d616b652d6f626a6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/brendt/php-make-object)

Write this:

```
$post = make(Post::class)->from($postData);
```

instead of this:

```
$reflectionExtractor = new ReflectionExtractor();

$phpDocExtractor = new PhpDocExtractor();

$propertyTypeExtractor = new PropertyInfoExtractor(
    listExtractors: [$reflectionExtractor],
    typeExtractors: [$phpDocExtractor, $reflectionExtractor],
    descriptionExtractors: [$phpDocExtractor],
    accessExtractors: [$reflectionExtractor],
    initializableExtractors: [$reflectionExtractor]
);

$normalizer = new ObjectNormalizer(
    propertyTypeExtractor: $propertyTypeExtractor
);

$arrayNormalizer = new ArrayDenormalizer();

$serializer = new SymfonySerializer(
    normalizers: [
        $arrayNormalizer,
        $normalizer,
    ],
    encoders: [
        new XmlEncoder(),
        new JsonEncoder(),
    ],
);

$post = $serializer->denormalize($postData, Post::class)
```

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

[](#installation)

You can install the package via composer:

```
composer require brendt/php-make-object
```

Usage
-----

[](#usage)

This package abstracts away all configuration needed for complex deserialization with [symfony/serializer](https://symfony.com/doc/current/components/serializer.html). All you need to do is say which class you want to make, provide it some input (arrays, JSON, XML, files or objects), and this package will take care of the rest.

Added bonus: proper static analysis, so you'll know what kind of object was created.

```
$post = make(Post::class)->from($postData);
```

### Input types

[](#input-types)

#### Arrays

[](#arrays)

```
$post = make(Post::class)->from([
    'title' => 'test',
]);
```

#### JSON

[](#json)

```
$post = make(Post::class)->from( 'test',
        ];
    }
}
```

#### Collections

[](#collections)

```
$posts = make(Post::class)->fromCollection([
    ['title' => 'a'],
    ['title' => 'b'],
    ['title' => 'c'],
]);
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Brent Roose](https://github.com/brendt)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

1264d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5cb3720658b52133e7200a378eae26508fb343534a3c115bd3ee74ea9d501ba2?d=identicon)[brendt](/maintainers/brendt)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (88 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (34 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (29 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (12 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![pforret](https://avatars.githubusercontent.com/u/474312?v=4)](https://github.com/pforret "pforret (9 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (7 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (4 commits)")[![gregkos](https://avatars.githubusercontent.com/u/6676236?v=4)](https://github.com/gregkos "gregkos (4 commits)")[![thecaliskan](https://avatars.githubusercontent.com/u/13554944?v=4)](https://github.com/thecaliskan "thecaliskan (3 commits)")[![irfanm96](https://avatars.githubusercontent.com/u/42065936?v=4)](https://github.com/irfanm96 "irfanm96 (2 commits)")[![erikn69](https://avatars.githubusercontent.com/u/4933954?v=4)](https://github.com/erikn69 "erikn69 (2 commits)")[![jamessessford](https://avatars.githubusercontent.com/u/17096446?v=4)](https://github.com/jamessessford "jamessessford (2 commits)")[![koossaayy](https://avatars.githubusercontent.com/u/6431084?v=4)](https://github.com/koossaayy "koossaayy (2 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (1 commits)")[![dietercoopman](https://avatars.githubusercontent.com/u/4672752?v=4)](https://github.com/dietercoopman "dietercoopman (1 commits)")[![cmgmyr](https://avatars.githubusercontent.com/u/4693481?v=4)](https://github.com/cmgmyr "cmgmyr (1 commits)")[![weerd](https://avatars.githubusercontent.com/u/105849?v=4)](https://github.com/weerd "weerd (1 commits)")

---

Tags

brendtphp-make-object

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/brendt-php-make-object/health.svg)

```
[![Health](https://phpackages.com/badges/brendt-php-make-object/health.svg)](https://phpackages.com/packages/brendt-php-make-object)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[api-platform/core

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

2.6k48.1M236](/packages/api-platform-core)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[api-platform/serializer

API Platform core Serializer

223.4M31](/packages/api-platform-serializer)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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