2017 © Pedro Peláez
 

library laravel-pagination-specification

A package for consistent pagination in Laravel.

image

joshbrw/laravel-pagination-specification

A package for consistent pagination in Laravel.

  • Monday, January 29, 2018
  • by joshbrw
  • Repository
  • 1 Watchers
  • 0 Stars
  • 725 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 13 % Grown

The README.md

Laravel Pagination Specification

The main purpose of this package is to provide a consistent object that represents all of the main values you have to take into account when paginating (i.e. Current Page, Per Page, Appends for the URLs)., (*1)

This object can then be passed around to methods and used for less verbose method parameters., (*2)

Installing

  1. composer require joshbrw/laravel-pagination-specification
  2. Add the following Service Provider to your config/app.php under provider: php Joshbrw\PaginationSpecification\PaginationSpecificationServiceProvider::class
  3. Optionally publish the config and change the default Per Page; bash php artisan vendor:publish --provider="Joshbrw\PaginationSpecification\PaginationSpecificationServiceProvider"

Usage

The class is bound into the container under the Joshbrw\PaginationSpecification\PaginationSpecification interface, and can be overwritten/decorated if required., (*3)

For example, injecting into a Controller method:, (*4)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\View\View;
use Joshbrw\PaginationSpecification\PaginationSpecification;

class UserController extends Controller {
    public function index(
        Request $request,
        PaginationSpecification $paginationSpecification,
        UserRepository $userRepository
    ): View {
        // Reads the `per_page` and `page` values from the request
        $paginationSpecification->fromRequest($request);

        // Set how many items we want per page
        $paginationSpecification->setPerPage(30);

        // This can now be passed around to other methods, which can typehint it as a dependency
        return $userRepository->get($paginationSpecification);
    }
}

The Versions

29/01 2018

dev-master

9999999-dev

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

29/01 2018

v0.1.9

0.1.9.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

17/11 2017

v0.1.8

0.1.8.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

27/10 2017

v0.1.7

0.1.7.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

22/08 2017

v0.1.6

0.1.6.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

09/06 2017

v0.1.5

0.1.5.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

09/06 2017

v0.1.4

0.1.4.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

09/06 2017

v0.1.3

0.1.3.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

09/06 2017

v0.1.2

0.1.2.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown

09/06 2017

v0.1.1

0.1.1.0

A package for consistent pagination in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Brown