PHPackages                             escapework/laravelhelpers - 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. escapework/laravelhelpers

ActiveLibrary

escapework/laravelhelpers
=========================

Some Laravel 4 helpers to enjoy even more development

0.7.4(11y ago)81.5k1MITPHPPHP &gt;=5.4.0

Since May 14Pushed 11y ago7 watchersCompare

[ Source](https://github.com/EscapeWork/LaravelHelpers)[ Packagist](https://packagist.org/packages/escapework/laravelhelpers)[ RSS](/packages/escapework-laravelhelpers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (26)Used By (0)

LaravelHelpers [![Build Status](https://camo.githubusercontent.com/1d81e71791fd2d778dffde87ece27dee7c346030a7b1c276c1d528025fd58ab0/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f457363617065576f726b2f4c61726176656c48656c706572732e706e67)](http://travis-ci.org/EscapeWork/LaravelHelpers) [![Latest Stable Version](https://camo.githubusercontent.com/b113b81aaf957adc12af9ca4bf61435a9e0a2f86a23d20e5e7a997bd2ef6439e/68747470733a2f2f706f7365722e707567782e6f72672f657363617065776f726b2f6c61726176656c68656c706572732f762f737461626c652e706e67)](https://packagist.org/packages/escapework/laravelhelpers) [![Total Downloads](https://camo.githubusercontent.com/f8587008bec283fbb434799c0d84228089d2a308c61b724632c8a873cdbc9cbe/68747470733a2f2f706f7365722e707567782e6f72672f657363617065776f726b2f6c61726176656c68656c706572732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/escapework/laravelhelpers)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#laravelhelpers---)

A set of tools and helpers to help the [Laravel 4](http://laravel.com) development.

### Instalation

[](#instalation)

Install via [Composer](https://packagist.org/packages/escapework/laravelhelpers).

```
{
    "require": {
        "escapework/laravelhelpers": "0.7.*"
    }
}
```

### Models

[](#models)

To make use of the best things in LaravelHelpers, please make sure all your models extends the `BaseModel` class.

```
use EscapeWork\LaravelHelpers\BaseModel;

class Product extends BaseModel
{

    // ...
}
```

#### Slugs

[](#slugs)

If you need to make an slug for your model, just use the `SluggableTrait`;

```
use EscapeWork\LaravelHelpers\BaseModel;
use EscapeWork\LaravelHelpers\SluggableTrait;

class Product extends BaseModel
{

    use SluggableTrait;
}
```

When executing the `save` and `update` method, the slug is going to be automatically generated by the helper.

The default slug is made by the attribute `title`. But if you have a diferent attribute, just declare the `$sluggableAttr` with the field name.

```
protected $sluggableAttr = 'name';
```

If you don't want the slug to change when updating your model, set the `$makeSlugOnUpdate` attribute on your model.

```
    protected $makeSlugOnUpdate = false;
```

And the, just use in the regular way your model:

```
    public function store()
    {
        $this->product->title = 'Hello World';
        $this->product->save();

        echo $this->product->slug; // prints hello-world
    }
}
```

#### Search

[](#search)

For search for multiple terms, you can use the `scopeSearch` method.

```
$products = $product->search('title', 'this title')->get();
```

This will convert the SQL too:

```
select * from products where title regexp 'this.+title'
```

#### Setters

[](#setters)

LaravelHelpers `BaseModel` have two setters method to help you:

##### \_setDateAttribute

[](#_setdateattribute)

```
// model
...
    public function setDateAttribute($date)
    {
        $this->_setDateAttribute('date', $date, $format = 'd/m/Y');
    }
...

// whaterer place you need
$model->date = '10/03/1991'; // this format should be the same as the above
```

If everything goes fine, `$model->date` will be an instance of `Carbon`. Otherwise, `$model->date` will be null.

##### \_setCurrencyAttribute

[](#_setcurrencyattribute)

```
// model
...
    public function setPriceBRLAttribute($price)
    {
        $this->_setCurrencyAttribute('priceBRL', $price);
    }

    public function setPriceAttribute($price)
    {
        $this->_setCurrencyAttribute('price', $price, 'USD');
    }
...

// whaterer place you need
$model->priceBRL = '10,90';
$model->price    = '10.90';

var_dump($model->priceBRL); // (float) 10.90';
var_dump($model->price);    // (float) 10.90';
```

If everything goes fine, a `float` value will be setted. Otherwise, the value will be null.

#### Combobox

[](#combobox)

LaravelHelpers have a method for make combobox easier when using with the `Form` class.

```
Form::select('product_id', Product::all()->combobox());
```

The default attribute for the option text is the `title` attribute. In case you need other field, just use like this:

```
Form::select('client_id', Client::all()->combobox(['field' => 'name']); // for using the 'name' field
```

If you want to create an 'empty' option, you can use like this:

```
Form::select('client_id', Client::all()->combobox(['field' => 'name', 'empty_option' => true, 'empty_option_label' => 'Select a client']));
```

---

The documentation below this line is for the version `0.6`, so not everything is the same for now.

### Find or Fail By

[](#find-or-fail-by)

```
$product = App::make('ProductRepository'); // just a sample, you probably will use dependency injection
$product->findOrFailBy('slug', 'office-chair');

dd($product->title);
```

If the product was not found, then a `Illuminate\Database\Eloquent\ModelNotFoundException` will be thrown, like the Eloquent function `findOrFail`.

License
-------

[](#license)

#### The MIT License (MIT)

[](#the-mit-license-mit)

Copyright (c) 2013 Escape Criativação LTDA

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 74.6% 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 ~27 days

Total

24

Last Release

4110d ago

PHP version history (2 changes)0.2.0PHP &gt;=5.3.0

0.7.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/57e405b52d482c9de35b17f299d2745e8e68d9d9951aec64854f2d7fa53110bf?d=identicon)[luisdalmolin](/maintainers/luisdalmolin)

---

Top Contributors

[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (88 commits)")[![ehkasper](https://avatars.githubusercontent.com/u/988603?v=4)](https://github.com/ehkasper "ehkasper (30 commits)")

### Embed Badge

![Health badge](/badges/escapework-laravelhelpers/health.svg)

```
[![Health](https://phpackages.com/badges/escapework-laravelhelpers/health.svg)](https://phpackages.com/packages/escapework-laravelhelpers)
```

PHPackages © 2026

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