nilportugues / serializer-eloquent-driver by nilportugues

Eloquent Driver for NilPortugues Serializer outputting valid API responses in JSON, JSON API and HAL+JSON API formats.
36,230
4
3
Package Data
Maintainer Username: nilportugues
Maintainer Contact: contact@nilportugues.com (Nil Portugués Calderó)
Package Create Date: 2015-11-21
Package Last Update: 2017-03-30
Home Page: http://nilportugues.com
Language: PHP
License: MIT
Last Refreshed: 2024-06-17 03:15:03
Package Statistics
Total Downloads: 36,230
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 4
Total Watchers: 3
Total Forks: 7
Total Open Issues: 4

Serializer Driver for Eloquent ORM Models

Build Status Scrutinizer Code Quality SensioLabsInsight Latest Stable Version Total Downloads License Donate

What?

This is a driver for the Serializer library caring of Eloquent ORM model serialization.

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 in a single library.

Installation

Use Composer to install the package:

$ composer require nilportugues/serializer-eloquent

Usage

This will return an array following the Serializer format.

use NilPortugues\Serializer\Drivers\Eloquent\EloquentDriver;

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

Todo

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

  • [X] One To One
  • [X] One To Many
  • [X] Has Many Through
  • [ ] Polymorphic Relations
  • [ ] Many To Many
  • [ ] Many To Many Polymorphic Relations

Contribute

Contributions to the package are always welcome!

Support

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

Authors

License

The code base is licensed under the MIT license.