PHPackages                             nilportugues/serializer-eloquent - 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. [Database &amp; ORM](/categories/database)
4. /
5. nilportugues/serializer-eloquent

ActiveLibrary[Database &amp; ORM](/categories/database)

nilportugues/serializer-eloquent
================================

Eloquent Driver for NilPortugues Serializer outputting valid API responses in JSON, JSON API and HAL+JSON API formats.

1.0.12(9y ago)536.3k7[1 issues](https://github.com/nilportugues/serializer-eloquent-driver/issues)[1 PRs](https://github.com/nilportugues/serializer-eloquent-driver/pulls)4MITPHPPHP &gt;=5.5.0

Since Nov 21Pushed 9y ago2 watchersCompare

[ Source](https://github.com/nilportugues/serializer-eloquent-driver)[ Packagist](https://packagist.org/packages/nilportugues/serializer-eloquent)[ Docs](http://nilportugues.com)[ RSS](/packages/nilportugues-serializer-eloquent/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (14)Used By (4)

Serializer Driver for Eloquent ORM Models
=========================================

[](#serializer-driver-for-eloquent-orm-models)

[![Build Status](https://camo.githubusercontent.com/7b30bf359744b3736065760468aae9d879de4764c867078b97b83277ed322457/68747470733a2f2f7472617669732d63692e6f72672f6e696c706f727475677565732f73657269616c697a65722d656c6f7175656e742d6472697665722e737667)](https://travis-ci.org/nilportugues/serializer-eloquent-driver)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/29b1cc65a8608a735f088d4a596ac445c2607ce743fbad7707b223602aac8e10/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696c706f727475677565732f73657269616c697a65722d656c6f7175656e742d6472697665722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nilportugues/serializer-eloquent-driver/?branch=master) [![SensioLabsInsight](https://camo.githubusercontent.com/a4f7eeea979367790d3901f02a0e3f359c81367ae14701a9359c5fb8ac1a1ed0/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34393766396535382d653937392d343533652d626330342d6231353031623838643032372f6d696e692e706e673f)](https://insight.sensiolabs.com/projects/497f9e58-e979-453e-bc04-b1501b88d027)[![Latest Stable Version](https://camo.githubusercontent.com/219c25412460e93f57e10b7b982193a05b83e1163133c3902ad37e6f936544dc/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f73657269616c697a65722d656c6f7175656e742f762f737461626c653f)](https://packagist.org/packages/nilportugues/serializer-eloquent)[![Total Downloads](https://camo.githubusercontent.com/969f3153f7bacf4cf609763352a4897d600b42f8b72ab252b64fc3dbe78a435e/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f73657269616c697a65722d656c6f7175656e742f646f776e6c6f6164733f)](https://packagist.org/packages/nilportugues/serializer-eloquent)[![License](https://camo.githubusercontent.com/04c261c9e7237671780ecf3fcfab83d9281c0c4ffb3a7676f02fc2aedf1ffc36/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f73657269616c697a65722d656c6f7175656e742f6c6963656e73653f)](https://packagist.org/packages/nilportugues/serializer-eloquent)[![Donate](https://camo.githubusercontent.com/7b6de155df30b37b25eb5fec52f9213680c3dbf067dfb7d7e2850ac4096c7d05/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e6174655f534d2e676966)](https://paypal.me/nilportugues)

What?
-----

[](#what)

This is a driver for the [Serializer](https://github.com/nilportugues/serializer) library caring of Eloquent ORM model serialization.

Why?
----

[](#why)

Due to the popularity of Eloquent, specially in Laravel apps, a driver has been develop to unite all Eloquent serialization edge-cases for [Serializer](https://github.com/nilportugues/serializer) in a single library.

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

[](#installation)

Use [Composer](https://getcomposer.org) to install the package:

```
$ composer require nilportugues/serializer-eloquent
```

Usage
-----

[](#usage)

This will return an array following the [Serializer](https://github.com/nilportugues/serializer) format.

```
use NilPortugues\Serializer\Drivers\Eloquent\EloquentDriver;

$serialized = EloquentDriver::serialize($value);
```

Todo
----

[](#todo)

Code all examples provided in the Eloquent documentation for relationships as tests:

- One To One
- One To Many
- Has Many Through
- Polymorphic Relations
- Many To Many
- Many To Many Polymorphic Relations

Contribute
----------

[](#contribute)

Contributions to the package are always welcome!

- Report any bugs or issues you find on the [issue tracker](https://github.com/nilportugues/serializer-eloquent-driver/issues/new).
- You can grab the source code at the package's [Git repository](https://github.com/nilportugues/serializer-eloquent-driver).

Support
-------

[](#support)

Get in touch with me using one of the following means:

- Emailing me at
- Opening an [Issue](https://github.com/nilportugues/serializer-eloquent-driver/issues/new)

Authors
-------

[](#authors)

- [Nil Portugués Calderó](http://nilportugues.com)
- [The Community Contributors](https://github.com/nilportugues/serializer-eloquent-driver/graphs/contributors)

License
-------

[](#license)

The code base is licensed under the [MIT license](LICENSE).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~41 days

Recently: every ~108 days

Total

13

Last Release

3330d ago

### Community

Maintainers

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

---

Top Contributors

[![nilportugues](https://avatars.githubusercontent.com/u/550948?v=4)](https://github.com/nilportugues "nilportugues (27 commits)")[![directrix1](https://avatars.githubusercontent.com/u/474780?v=4)](https://github.com/directrix1 "directrix1 (2 commits)")[![HennerM](https://avatars.githubusercontent.com/u/1714412?v=4)](https://github.com/HennerM "HennerM (1 commits)")

---

Tags

drivereloquent-orm-modelsserializerresponsejsonapilaravelpsr7ormserializereloquentjsonapitransformernilportugues

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nilportugues/laravel5-json-api

Laravel 5 JSON API Transformer Package

31232.4k1](/packages/nilportugues-laravel5-json-api)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[nilportugues/jsonapi-bundle

Symfony 2 &amp; 3 JSON API Transformer Package

11446.0k](/packages/nilportugues-jsonapi-bundle)[nilportugues/json-api

Serializer transformers outputting valid API responses in JSON, JSON API and HAL+JSON API formats.

70106.2k3](/packages/nilportugues-json-api)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[nilportugues/laravel5-json-api-dingo

Laravel5 JSONAPI and Dingo together to build APIs fast

311.5k](/packages/nilportugues-laravel5-json-api-dingo)

PHPackages © 2026

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