PHPackages                             gitnik/jms-typed-properties-driver - 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. gitnik/jms-typed-properties-driver

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

gitnik/jms-typed-properties-driver
==================================

Allows you to use typed properties for JMS serialization

0.0.1(6y ago)36.7k2[1 PRs](https://github.com/gitnik/jms-typed-properties-driver/pulls)MITPHPPHP &gt;=7.4CI passing

Since Jan 6Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/gitnik/jms-typed-properties-driver)[ Packagist](https://packagist.org/packages/gitnik/jms-typed-properties-driver)[ RSS](/packages/gitnik-jms-typed-properties-driver/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

Warning
-------

[](#warning)

**Do not use this in a production environment. While the base cases work, I am sure there are plenty of untested edge-cases**

Usage
-----

[](#usage)

#### Deserialization:

[](#deserialization)

```
class Make {
    private string $name;
}

class Car {
    private string $color;
    private Make $make;
}

$inputData = [
    'color' => 'red',
    'make' => [
        'name' => 'Tesla'
    ]
];

$serializer = SerializerBuilder::create()
    ->setMetadataDriverFactory(new TypedPropertiesDriverFactory())
    ->build();

$car = $serializer->deserialize(
   json_encode($inputData),
   Car::class,
   'json'

// interact with your Car object

);
```

#### Serialization:

[](#serialization)

```
class Make {
    public string $name;
}

class Car {
    public string $color;
    public Make $make;
}

$make = new Make();
$make->name = 'Tesla';

$car = new Car();
$car->make = $make;
$car->color = 'red';

$serializer = SerializerBuilder::create()
    ->setMetadataDriverFactory(new TypedPropertiesDriverFactory())
    ->build();

$json = $serializer->serialize(
   $car,
   'json'

/*
{
    "color": "red",
    "make": {
        "name": "Tesla"
    }
}
*/
);
```

How it works
------------

[](#how-it-works)

JMS/Serializer has the concept of drivers, which are used to gather configuration information about an object it wants to (de)serialize. An example of this would be the Annotation driver, which reads configuration via annotations.

What this library does is, wrap whatever driver is currently being used and enhance the information acquired by the "default" driver with type information gathered via reflection.

This means you can gradually migrate towards type-hinted properties on a property-by-property basis and also mix different ways of configuration, like so:

```
class Car {
    /**
     * @SerializedName("colour")
     */
    private string $color;
}
```

Limitations:
------------

[](#limitations)

1. While it can handle null values for (de)serialization, you are not allowed to omit properties during deserialization that have been typed-hinted, as those must always be initialized before they can be accessed
2. There has been a long-standing issue with the parent library regarding coercing values instead of type-checking them ([schmittjoh/serializer#561](https://github.com/schmittjoh/serializer/issues/561)). This library has no influence on this behaviour

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance54

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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

Unknown

Total

1

Last Release

2315d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9303bea2007e01043c3e0c8de360af0d82bc83a3ae9286925bf736ba3d61e8f?d=identicon)[technik](/maintainers/technik)

---

Top Contributors

[![gitnik](https://avatars.githubusercontent.com/u/996623?v=4)](https://github.com/gitnik "gitnik (5 commits)")[![chrisyoungbrighte](https://avatars.githubusercontent.com/u/128448021?v=4)](https://github.com/chrisyoungbrighte "chrisyoungbrighte (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gitnik-jms-typed-properties-driver/health.svg)

```
[![Health](https://phpackages.com/badges/gitnik-jms-typed-properties-driver/health.svg)](https://phpackages.com/packages/gitnik-jms-typed-properties-driver)
```

###  Alternatives

[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M622](/packages/jms-serializer-bundle)[goetas-webservices/xsd2php-runtime

Convert XSD (XML Schema) definitions into PHP classes

4910.9M34](/packages/goetas-webservices-xsd2php-runtime)[easybill/zugferd-php

ZUGFeRD PHP SDK (Factur-X, XRechnung) - Convert PHP Objects to XML and back.

99295.7k7](/packages/easybill-zugferd-php)[liip/serializer-jms-adapter

Adapter to use liip/serializer in place of jms/serializer.

10273.5k](/packages/liip-serializer-jms-adapter)[friendsofcxml/cxml-php

PHP Implementation of cXML Standard

16100.6k2](/packages/friendsofcxml-cxml-php)[jansenfelipe/nfephp-serialize

Transforme NFe(xml) em objetos PHP (e vice-versa)

714.4k](/packages/jansenfelipe-nfephp-serialize)

PHPackages © 2026

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