PHPackages                             oscabrera/laravel-json-api-format-paginate - 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. [API Development](/categories/api)
4. /
5. oscabrera/laravel-json-api-format-paginate

ActiveLibrary[API Development](/categories/api)

oscabrera/laravel-json-api-format-paginate
==========================================

this package allows you to paginate resources using the JSON:API format

v1.1.1(4mo ago)0705↓62.5%[1 issues](https://github.com/Oscabrera/laravel-json-api-format-paginate/issues)1MITPHPPHP ^8.1

Since Jun 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/Oscabrera/laravel-json-api-format-paginate)[ Packagist](https://packagist.org/packages/oscabrera/laravel-json-api-format-paginate)[ Docs](https://github.com/Oscabrera/laravel-json-api-format-paginate)[ RSS](/packages/oscabrera-laravel-json-api-format-paginate/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (11)Used By (1)

Laravel JSON:API Format Paginate
================================

[](#laravel-jsonapi-format-paginate)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7e52925a8b923641ab9fdb7d123bf4d2409225ed50bed6143b3d90e811b5c596/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f73636162726572612f6c61726176656c2d6a736f6e2d6170692d666f726d61742d706167696e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oscabrera/laravel-json-api-format-paginate)[![Total Downloads](https://camo.githubusercontent.com/1d43b1c1b18e3f0c1337a637c798bed6264e74b4cdd6e0ccc7a6af161daa91af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f73636162726572612f6c61726176656c2d6a736f6e2d6170692d666f726d61742d706167696e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oscabrera/laravel-json-api-format-paginate)

[![VitePress](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/deploy.yml/badge.svg)](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/deploy.yml)[![PHPStan](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/phpstan.yml/badge.svg)](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/phpstan.yml)[![Pint](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/pint.yml/badge.svg)](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/pint.yml)[![PHPMD](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/phpmd.yml/badge.svg)](https://github.com/oscabrera/laravel-json-api-format-paginate/actions/workflows/phpmd.yml)

[![built with Codeium](https://camo.githubusercontent.com/c077f56a19fff290283d9bc7304591176ee195d4b66d13e5bc6d77a62cabc776/68747470733a2f2f636f646569756d2e636f6d2f6261646765732f6d61696e)](https://codeium.com)

[![laravel-json-api-format-paginate](https://camo.githubusercontent.com/94e88dad21ea329dff523d445a35a44fda2107c5110b3c2006995d035e0f493d/68747470733a2f2f736f6369616c6966792e6769742e63692f4f73636162726572612f6c61726176656c2d6a736f6e2d6170692d666f726d61742d706167696e6174652f696d6167653f6c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d466c6f6174696e67253230436f6773267468656d653d4175746f)](https://camo.githubusercontent.com/94e88dad21ea329dff523d445a35a44fda2107c5110b3c2006995d035e0f493d/68747470733a2f2f736f6369616c6966792e6769742e63692f4f73636162726572612f6c61726176656c2d6a736f6e2d6170692d666f726d61742d706167696e6174652f696d6167653f6c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d466c6f6174696e67253230436f6773267468656d653d4175746f)

Please follow the documentation at [laravel-json-api-format-paginate](https://oscabrera.github.io/laravel-json-api-format-paginate/).

This package provides three classes to respond with Resource and Collection in [JSON:API](https://jsonapi.org/) format. It simplifies the transformation of Eloquent models and pagination results into JSON compliant responses.

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

[](#installation)

Install the package via Composer:

```
composer require oscabrera/laravel-json-api-format-paginate
```

In the Model:
=============

[](#in-the-model)

Is important use properties `$fillable` and `$hidden` in your model.

in `$hidden` you have to add `id` in your model.

```
protected $hidden = [
        'id',
    ];
```

In `$fillable` you should add all the properties you want to be returned by your model.

Usage
-----

[](#usage)

### EntityResourceTransformer

[](#entityresourcetransformer)

`EntityResourceTransformer` transforms individual resources into JSON:API format.

```
