2017 © Pedro Peláez
 

library fractal-illuminate-paginator

Bring back the Illuminate pagination results to your Fractal serializer

image

pbmedia/fractal-illuminate-paginator

Bring back the Illuminate pagination results to your Fractal serializer

  • Tuesday, August 2, 2016
  • by collicore
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Fractal Illuminate paginator

Latest Version on Packagist Software License Build Status Quality Score Total Downloads, (*1)

The Fractal package serializes the paginator different than the Illuminate paginator. This trait brings the serialization of the Illuminate paginator back to a Fractal serializer. Extend your serializer of choice, use this trait and you're done!, (*2)

Installation

You can install the package via composer:, (*3)

``` bash composer require pbmedia/fractal-illuminate-paginator, (*4)


## Usage Create your own ```Serializer``` and use the trait from this package: ```php <?php namespace Pbmedia\App\Serializers; use League\Fractal\Serializer\DataArraySerializer as BaseSerializer; use Pbmedia\Serializers\FractalIlluminatePaginatorTrait; class DataArraySerializer extends BaseSerializer { use FractalIlluminatePaginatorTrait; }

Without the trait, the pagination results will be like this:, (*5)

{
    data: [{
        id: 1,
        ...
    }, {
        id: 2,
        ...
    }, ...],
    meta: {
        pagination: {
            total: 33,
            count: 15,
            per_page: 15,
            current_page: 1,
            total_pages: 3,
            links: {
                next: "http://project.dev/api/v1/company?page=2"
            }
        }
    }
}

With the trait, the pagination results will be like this, just as you would convert a Illuminate\Pagination\LengthAwarePaginator to JSON., (*6)

{
    data: [{
        id: 1,
        ...
    }, {
        id: 2,
        ...
    }, ...],
    meta: {
        pagination: {
            total: 33,
            per_page: 15,
            current_page: 1,
            last_page: 3,
            next_page_url: "http://project.dev/api/v1/company?page=2",
            prev_page_url: null,
            from: 1,
            to: 15
        }
    }
}

Security

If you discover any security related issues, please email pascal@pascalbaljetmedia.com instead of using the issue tracker., (*7)

Credits

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

02/08 2016

dev-master

9999999-dev

Bring back the Illuminate pagination results to your Fractal serializer

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel illuminate paginator fractal

02/08 2016

1.0.1

1.0.1.0

Bring back the Illuminate pagination results to your Fractal serializer

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel illuminate paginator fractal

02/08 2016

1.0.0

1.0.0.0

Bring back the Illuminate pagination data to your Fractal serializer

  Sources   Download

MIT

The Requires

 

laravel illuminate paginator fractal