Looking to hire Laravel developers? Try LaraJobs

laravel-helpers maintained by billowapp

Description
Helper classes for everyday tasks at Billow.
Author
Last update
2026/10/21 13:30 (dev-fix/laravel-13-observer-boot)
License
Links
Downloads
498

Comments
comments powered by Disqus

Laravel Helpers, by Billow

forthebadge forthebadge

Installation

composer require billowapp/laravel-helpers

If your version of Laravel doesn’t support package auto-discovery, add the provider to config/app.php:

Billow\Utilities\BillowHelperProvider::class

If you’d like to access the StringClean Facade as an Alias, add this too:

'StringClean' => Billow\Utilities\Facades\StringClean::class

Model Traits

Laravel Helpers comes with some useful model traits that you can use to manipulate attributes on the fly, wither using helper methods, or observer-initialisers.

LaundersMoney

This trait provides simple helpers to work with the Money class, included in billowapp/show-me-the-money (installed via this package).

use Billow\Utilities\Traits\LaundersMoney;

Available helpers:

asCents($amount): int Returns your money in cents. Because coins are cool. Example: 50 is stored as 5000.

asMoney($amount): float Floats your cents back to money. Example: 5000 is stored as 50.

asCurrency($amount): float Uses a formatter to format your cents as currency. Example 5000 => R 50.00

Access & Mutate:

To use these, simply use the applicable accessor and mutator methods for the concerned attributes:

public function setPriceAttribute($price)
{
  $this->attributes['price'] = $this->asCents((string) $price);
}

public function getPriceAttribute($price)
{
  return $this->asMoney($price);
}

Or, you can use the built-in observer-initialisers, via the $launderable class-property:

protected $launderable = [
  'price'
];

EncryptsThings

This trait can only be initialised via observer-initialisers, as the encrypt/decrypt helpers are already available to you, so no extra effort is required to access them in a clean way.

To enable on-the-fly encryption in your model:

use Billow\Utilities\Traits\EncryptsThings;

…

protected $encryptable = [
  'id_number',
  'passport_number'
];