PHPackages                             vigihdev/serializer - 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. vigihdev/serializer

ActiveLibrary

vigihdev/serializer
===================

A Symfony-inspired serializer library for PHP

033PHPCI passing

Since Oct 28Pushed 6mo agoCompare

[ Source](https://github.com/vigihdev/serializer)[ Packagist](https://packagist.org/packages/vigihdev/serializer)[ RSS](/packages/vigihdev-serializer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)[![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)

Serializer Package
==================

[](#serializer-package)

A simple, powerful JSON serializer library for PHP inspired by Symfony components. Transform JSON data into PHP objects with ease.

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

[](#installation)

```
composer require vigihdev/serializer
```

Quick Start
-----------

[](#quick-start)

```
use Serializer\Factory\JsonTransformerFactory;

// Transform JSON file to objects
$transformer = JsonTransformerFactory::create(YourDTO::class);
$objects = $transformer->transformWithFile('data.json');

// Or transform JSON string
$json = '{"name": "John", "age": 30}';
$object = $transformer->transformJson($json);
```

Features
--------

[](#features)

- ✅ Transform JSON to PHP objects
- ✅ Handle both single objects and arrays
- ✅ File-based and string-based transformation
- ✅ Symfony Serializer integration
- ✅ Proper error handling with custom exceptions
- ✅ Type safety with PHP 8.1+ features

Usage Examples
--------------

[](#usage-examples)

### Basic DTO

[](#basic-dto)

```
class UserDto
{
    public function __construct(
        public readonly string $name,
        public readonly int $age,
        public readonly string $email
    ) {}
}
```

### Transform from File

[](#transform-from-file)

```
$transformer = JsonTransformerFactory::create(UserDto::class);
$users = $transformer->transformWithFile('users.json');

foreach ($users as $user) {
    echo $user->name . ': ' . $user->email;
}
```

### Transform from JSON String

[](#transform-from-json-string)

```
$json = '{"name": "Alice", "age": 25, "email": "alice@example.com"}';
$user = $transformer->transformJson($json);

echo $user->name; // "Alice"
```

Error Handling
--------------

[](#error-handling)

```
use Serializer\Exception\TransformerException;

try {
    $transformer->transformWithFile('invalid.json');
} catch (TransformerException $e) {
    echo "Error: " . $e->getMessage();
}
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Symfony Serializer Component

License
-------

[](#license)

MIT License - feel free to use in your projects!

---

**Simple · Fast · Reliable**

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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/bace572fc25f16fc80012c44703f3000ac48b1238aa82a6316885749f4bcb47f?d=identicon)[vigihdev](/maintainers/vigihdev)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/vigihdev-serializer/health.svg)

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

PHPackages © 2026

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