PHPackages                             sylvrs/libmarshal - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sylvrs/libmarshal

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sylvrs/libmarshal
=================

A library used for marshalling/unmarshalling data into objects

1.4.3(4y ago)161.1k4[1 issues](https://github.com/sylvrs/libMarshal/issues)gpl-3.0PHPPHP &gt;=8.0

Since Apr 23Pushed 1y ago2 watchersCompare

[ Source](https://github.com/sylvrs/libMarshal)[ Packagist](https://packagist.org/packages/sylvrs/libmarshal)[ RSS](/packages/sylvrs-libmarshal/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

libMarshal
==========

[](#libmarshal)

A small marshalling library used to encode/decode data from classes.

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

[](#installation)

### Composer

[](#composer)

To install this library through composer, run the following command:

```
composer require sylvrs/libmarshal

```

### Virion

[](#virion)

The virion for this library can be accessed [here](https://poggit.pmmp.io/ci/sylvrs/libMarshal/libMarshal).

Basic Example
-------------

[](#basic-example)

Here is a basic example on how this library is used:

```
class User {
	use MarshalTrait;

	public function __construct(
            #[Field(name: "first-name")]
            public string $firstName,
            #[Field(name: "last-name")]
            public string $lastName,
            public int $age,
            public string $email,
            #[Exclude]
            public string $internalData = "..."
	) {}
}

// NOTE: This uses promoted properties to make it easier to construct.
// You can learn more about this below.

// Marshalling
$user = new User(firstName: "John", lastName: "Doe", age: 30, email: "johndoe@gmail.com");
$data = $user->marshal(); // ["first-name" => "John", "last-name" => "Doe", "age" => 30, "email" => "johndoe@gmail.com"]

$data["first-name"] = "Jane"; // Changing the first name
$data["email"] = "janedoe@gmail.com"; // Changing the email

// Unmarshalling
$user = User::unmarshal($data); // User(firstName: "Jane", lastName: "Doe", age: 30, email: "janedoe@gmail.com")
```

Wiki
----

[](#wiki)

To learn about how to use the library, please consult the wiki [here](https://github.com/sylvrs/libMarshal/wiki).

Roadmap
-------

[](#roadmap)

At the moment, there are a few improvements that can be/or are being worked on. Here is a list of some of those improvements:

- Add a limit to recursive objects when marshalling/unmarshalling (50?)
- Cache properties for performance benefits

Issues
------

[](#issues)

Any issues/suggestions can be reported [here](https://github.com/sylvrs/libMarshal/issues).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

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

Total

3

Last Release

1480d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c8f558299ae6ceaec9257a8cdafaceef401d6c61aa5a8b84e630a1073a160c5?d=identicon)[sylvrs](/maintainers/sylvrs)

---

Top Contributors

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

---

Tags

marshalphpunmarshal

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sylvrs-libmarshal/health.svg)

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

###  Alternatives

[ebess/advanced-nova-media-library

Laravel Nova tools for managing the Spatie media library.

6123.3M21](/packages/ebess-advanced-nova-media-library)

PHPackages © 2026

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