PHPackages                             gathercontent/laravel-fractal - 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. gathercontent/laravel-fractal

ActiveLibrary[API Development](/categories/api)

gathercontent/laravel-fractal
=============================

A Laravel Service Provider for Fractal

1.0.1(9y ago)50160.0k—8.7%11[5 issues](https://github.com/gathercontent/laravel-fractal/issues)[1 PRs](https://github.com/gathercontent/laravel-fractal/pulls)MITPHPPHP &gt;=5.3.0

Since Aug 26Pushed 9y ago9 watchersCompare

[ Source](https://github.com/gathercontent/laravel-fractal)[ Packagist](https://packagist.org/packages/gathercontent/laravel-fractal)[ RSS](/packages/gathercontent-laravel-fractal/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Laravel Fractal
===============

[](#laravel-fractal)

A Laravel Service Provider for [League/Fractal](http://fractal.thephpleague.com).

---

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

[](#installation)

Add laravel-fractal to your composer.json file:

```
"require": {
    "gathercontent/laravel-fractal": "~1.0"
}
```

Get composer to install the package:

```
$ composer require gathercontent/laravel-fractal

```

### Registering the Package

[](#registering-the-package)

Register the service provider within the `providers` array found in `app/config/app.php`:

```
'providers' => array(
    // ...
    GatherContent\LaravelFractal\LaravelFractalServiceProvider::class
)
```

Add an alias within the `aliases` array found in `app/config/app.php`:

```
'aliases' => array(
    // ...
    'Fractal' => GatherContent\LaravelFractal\LaravelFractalFacade::class,
)
```

### Configuration

[](#configuration)

To override the default configuration, you can publish the config files to your application. Artisan can do this automatically for you via the command line:

```
$ php artisan vendor:publish
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

Formatting a single item:

```
// routes.php
Route::get('/me', array('before' => 'auth', function () {
    return Fractal::item(Auth::user(), new UserTransformer);
}));
```

Formatting a collection:

```
// routes.php
Route::get('/comments', function () {
    return Fractal::collection(Comment::all(), new CommentTransformer);
});
```

Adding meta data:

```
// routes.php
Route::get('/comments', function () {
    return Fractal::collection(Comment::all(), new CommentTransformer, function ($resources) {
        $resources->setMetaValue('foo', 'bar');
    });
});
```

Returning a paginated collection:

```
// routes.php
Route::get('/comments', function () {
    return Fractal::collection(Comment::paginate(), new CommentTransformer);
});
```

Using a custom pagination adapter:

```
// routes.php
Route::get('/comments', function () {
    $comments = Comment::paginate();
    $adapter = new MyIlluminatePaginationAdapter($comments);
    return Fractal::collection($comments, new CommentTransformer, null, $adapter);
});
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 87.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~206 days

Total

5

Last Release

3457d ago

Major Versions

0.1.2 → 1.0.02016-11-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5dae8137f77f73bd62111efb8c2841baf8e3991a4b1227c673dd9d882c4c5f1?d=identicon)[gathercontent](/maintainers/gathercontent)

---

Top Contributors

[![acairns](https://avatars.githubusercontent.com/u/705212?v=4)](https://github.com/acairns "acairns (48 commits)")[![bagwaa](https://avatars.githubusercontent.com/u/825428?v=4)](https://github.com/bagwaa "bagwaa (6 commits)")[![incraigulous](https://avatars.githubusercontent.com/u/5910297?v=4)](https://github.com/incraigulous "incraigulous (1 commits)")

---

Tags

laravelfractal

### Embed Badge

![Health badge](/badges/gathercontent-laravel-fractal/health.svg)

```
[![Health](https://phpackages.com/badges/gathercontent-laravel-fractal/health.svg)](https://phpackages.com/packages/gathercontent-laravel-fractal)
```

###  Alternatives

[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[flugger/laravel-responder

A Laravel Fractal package for building API responses, giving you the power of Fractal and the elegancy of Laravel.

8901.5M5](/packages/flugger-laravel-responder)[yajra/laravel-datatables-fractal

Laravel DataTables Fractal Plugin.

966.9M29](/packages/yajra-laravel-datatables-fractal)[cyvelnet/laravel5-fractal

A simple fractal service provider and transformer generator with model attributes for laravel &gt;=5.

79187.2k1](/packages/cyvelnet-laravel5-fractal)[appkr/api

RESTful HTTP API dev tool for Laravel or Lumen based project

3115.0k](/packages/appkr-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
