PHPackages                             tamaspap/laravel5-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. tamaspap/laravel5-fractal

ActiveLibrary[API Development](/categories/api)

tamaspap/laravel5-fractal
=========================

A simple fractal service provider and transformer generator for laravel 5.

1.3(10y ago)120MITPHPPHP &gt;=5.4.0

Since Mar 18Pushed 10y agoCompare

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

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

laravel5-fractal
================

[](#laravel5-fractal)

A simple fractal service provider and transformer generator for laravel 5 and lumen

welcome to my first laravel package, lets rock.

### New: Since version 1.2 auto class aliase has been removed.

[](#new-since-version-12-auto-class-aliase-has-been-removed)

Require this package with composer using the following command:

```
composer require cyvelnet/laravel5-fractal

```

#### Laravel 5

[](#laravel-5)

After updating composer, add the ServiceProvider to the providers array in config/app.php for laravel&gt;=5

```
Cyvelnet\Laravel5Fractal\Laravel5FractalServiceProvider::class,

```

and register Facade

```
'Fractal' => Cyvelnet\Laravel5Fractal\Facades\Fractal::class

```

#### Lumen

[](#lumen)

register service provider in /bootstrap/app.php for lumen

```
$app->register(Cyvelnet\Laravel5Fractal\Laravel5FractalServiceProvider::class);

```

and uncomment the line

```
$app->withFacades();

```

and finally register Facade with

```
class_alias(Cyvelnet\Laravel5Fractal\Facades\Fractal::class, 'Fractal');

```

Now you can start using this package with the following simple command

```
$user = User::find(1);

return Fractal::item($user, new UserTransformer)->responseJson(200);

```

OR

```
$users = User::get(); // $users = User::paginate();

return Fractal::collection($users, new UserTransformer)->responseJson(200);

```

You will automatically gain some extra attributes when you passing a laravel's paginator object.

In case you would like to get only the transformed array, you may do

```
Fractal::collection($user, new UserTransformer)->getArray();

```

You may now generate transformer classes in artisan

```
php artisan make:transformer

```

in this case we are going to use artisan make:transformer UserTransformer, transformer file will automatically created in App\\Transfomers\\ directory

now you may open your generated transformer file and start formatting your data as you like

```
public function transform($user)
{
    return [
           'id' => $user->user_id,
           'name' => "{$user->user_firstname} {$user->user_lastname}",
           ...
           ];
}

```

You can also publish the config-file to change implementations to suits you.

```
php artisan vendor:publish

```

#### For the reason, number of changes to port to Lumen are very minimal, new branch will be added for future breaking changes between laravel 5 and lumen.

[](#for-the-reason-number-of-changes-to-port-to-lumen-are-very-minimal-new-branch-will-be-added-for-future-breaking-changes-between-laravel-5-and-lumen)

##### TO DO

[](#to-do)

- add functionality to artisan command to generate sub transformer and includes function boilerplate

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 86.5% 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 ~16 days

Recently: every ~33 days

Total

10

Last Release

3936d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b28d5dfcc71ba2e6c2890df4256e81d459e5da990a1ee2de38b61192ac38273?d=identicon)[paptamas](/maintainers/paptamas)

---

Top Contributors

[![Cyvelnet](https://avatars.githubusercontent.com/u/11516087?v=4)](https://github.com/Cyvelnet "Cyvelnet (32 commits)")[![SeoFood](https://avatars.githubusercontent.com/u/2766011?v=4)](https://github.com/SeoFood "SeoFood (2 commits)")[![2bj](https://avatars.githubusercontent.com/u/71068?v=4)](https://github.com/2bj "2bj (1 commits)")[![joedawson](https://avatars.githubusercontent.com/u/1009696?v=4)](https://github.com/joedawson "joedawson (1 commits)")[![tamaspap](https://avatars.githubusercontent.com/u/1059643?v=4)](https://github.com/tamaspap "tamaspap (1 commits)")

---

Tags

laravel5fractalApi transformer

### Embed Badge

![Health badge](/badges/tamaspap-laravel5-fractal/health.svg)

```
[![Health](https://phpackages.com/badges/tamaspap-laravel5-fractal/health.svg)](https://phpackages.com/packages/tamaspap-laravel5-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)[cyvelnet/laravel5-fractal

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

79187.2k1](/packages/cyvelnet-laravel5-fractal)[scottybo/laravel-google-my-business

A package for Laravel which implements the Google My Business API

3360.3k](/packages/scottybo-laravel-google-my-business)[reliqarts/laravel-scavenger

The most integrated web scraper package for Laravel.

1571.5k](/packages/reliqarts-laravel-scavenger)[casinelli/laravel-campaignmonitor

A Laravel 5 wrapper for Campaign Monitor

1444.7k](/packages/casinelli-laravel-campaignmonitor)

PHPackages © 2026

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