nilportugues / serializer-eloquent
Eloquent Driver for NilPortugues Serializer outputting valid API responses in JSON, JSON API and HAL+JSON API formats.
Installs: 36 245
Dependents: 4
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 7
Open Issues: 3
Requires
- php: >=5.5.0
- illuminate/database: ^5.1
- illuminate/pagination: ^5.1
- nilportugues/serializer: ^1
Requires (Dev)
- fabpot/php-cs-fixer: ^1.9
- phpunit/phpunit: 4.4.*
README
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:
- One To One
- One To Many
- Has Many Through
- Polymorphic Relations
- Many To Many
- Many To Many Polymorphic Relations
Contribute
Contributions to the package are always welcome!
- Report any bugs or issues you find on the issue tracker.
- You can grab the source code at the package's Git repository.
Support
Get in touch with me using one of the following means:
- Emailing me at contact@nilportugues.com
- Opening an Issue
Authors
License
The code base is licensed under the MIT license.