PHPackages                             lasselehtinen/cybertron - 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. [Templating &amp; Views](/categories/templating)
4. /
5. lasselehtinen/cybertron

ActiveLibrary[Templating &amp; Views](/categories/templating)

lasselehtinen/cybertron
=======================

Fractal Transformer generator for Laravel

0.1.0(9y ago)91.8k2MITPHP

Since Jan 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/lasselehtinen/cybertron)[ Packagist](https://packagist.org/packages/lasselehtinen/cybertron)[ RSS](/packages/lasselehtinen-cybertron/feed)WikiDiscussions master Synced 4w ago

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

Fractal Transformer generator for Laravel
=========================================

[](#fractal-transformer-generator-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/efeede014960db8ec37b6a3f8fe76ab7ee646cddf45ef5f70a831e450dbf110a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c617373656c656874696e656e2f637962657274726f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lasselehtinen/cybertron)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/e70764f2cdcbe52978fee0977c847295ca9610e4be5dfbac25e73847fd0f6b48/68747470733a2f2f7472617669732d63692e6f72672f6c617373656c656874696e656e2f637962657274726f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lasselehtinen/cybertron)[![Quality Score](https://camo.githubusercontent.com/eb411a9440d71738a03f14045ac159b3e4c293922fe9432668120720880e7ef0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c617373656c656874696e656e2f637962657274726f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/lasselehtinen/cybertron)[![StyleCI](https://camo.githubusercontent.com/b58466037ca8782280d15ca81f293179c39cbd1197d6d4e63dd64646e3a92735/68747470733a2f2f7374796c6563692e696f2f7265706f732f34333734333133382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/43743138)[![Total Downloads](https://camo.githubusercontent.com/725a88abcc5ae8fb400aa22f2140571d21bebe0bf9e863829cbd9f523a4a01b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c617373656c656874696e656e2f637962657274726f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lasselehtinen/cybertron)

The package provides an easy way to generate [Fractal Transformers](http://fractal.thephpleague.com/transformers/)for your Laravel applications. The package automatically scans the models Eloquent relationships and attributes and generates the Transformer boiler plate. It also automatically adds casting for integer and boolean fields.

Example
-------

[](#example)

### Model

[](#model)

```
class TestModel extends Model
{
    /**
     * Example hasMany relationship
     */
    public function hasManySomethings()
    {
        return $this->hasMany(SomeOtherModel::class);
    }
}
```

### Migration

[](#migration)

```
    public function up()
    {
        Schema::create('test_models', function (Blueprint $table) {
            $table->increments('id_field');
            $table->boolean('boolean_field');
            $table->string('string_field');
        });
    }
```

### Result

[](#result)

```
