PHPackages                             riipandi/laravel-helpers - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. riipandi/laravel-helpers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

riipandi/laravel-helpers
========================

A collection of awesome helpful functions for Laravel

v1.0(6y ago)01241MITPHPPHP ^7.2.5

Since Mar 10Pushed 6y agoCompare

[ Source](https://github.com/riipandi/laravel-helpers)[ Packagist](https://packagist.org/packages/riipandi/laravel-helpers)[ Docs](https://github.com/riipandi/laravel-helpers)[ RSS](/packages/riipandi-laravel-helpers/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

A collection of awesome helpful functions for Laravel
=====================================================

[](#a-collection-of-awesome-helpful-functions-for-laravel)

Originally taken from . Thanks Caleb.

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

[](#installation)

```
composer require riipandi/laravel-helpers
```

Helpers
-------

[](#helpers)

**carbon**

Shortcut for: `new Carbon` or `Carbon::parse()`

```
carbon('One year ago');
```

**chain**

Makes an ordinary object chainable.

```
chain(new SomeClass)
    ->firstMethod()
    ->secondMethod()
    ->thirdMethod();

// You can use the "carry" constant to pass the result of one method into the other:
chain(new Str)->singular('cars')->ucfirst(carry)();
// Returns "Car"
// Also, you can grab the result of the chain by trailing
// a "()" on the end of it. (Thanks to Taylor Otwell for these two additions)
```

**connection**

Run callback under a different database connection.

```
$tenantPostIds = connection('tenantdb', function () {
    return Post::pluck('id');
});
```

**dump\_sql**

Returns sql query with bindings data.

```
dump_sql(\DB::table('users')->where('email', "blaBla")->where('id', 1));
// returns "select * from `users` where `email` = 'blaBla' and `id` = 1"
```

**faker**

Shortcut for: `$faker = Faker\Factory::create()`

```
faker()->address; // returns random, fake address
faker('address'); // alternate syntax
```

**user**

A shortcut for `auth()->user()`

```
user()->posts()->create([...]);
```

**money**

```
echo money(12); // echoes "$12.00"
echo money(12.75); // echoes "$12.75"
echo money(12.75, false); // echos "$13"
echo money(12.75, true, 'en_GB'); // echos "£12.75"
// Note: unless specified otherwise, money() will detect the current locale.
```

**stopwatch**

Returns the amount of time (in seconds) the provided callback took to execute. Useful for debugging and profiling.

```
stopwatch(function () {
    sleep(2);
}); // returns "2.0"
```

**str\_between**

```
str_between('--thing--', '--'); // returns "thing"
str_between('[thing]', '[', ']'); // returns "thing"

Str::between('--thing--', '--'); // returns "thing"
Str::between('[thing]', '[', ']'); // returns "thing"
```

**str\_extract**

Returns capture groups contained in the provided regex pattern.

```
str_extract('Jan-01-2019', '/Jan-(.*)-2019/'); // returns "01"

Str::extract('Jan-01-2019', '/Jan-(.*)-2019/'); // returns "01"
```

**str\_match**

Checks the provided string against the provided regex pattern.

```
str_match('Jan-01-2019', '/Jan-.*-2019/'); // returns true
str_match('foo bar baz', 'bar'); // returns true

Str::match('Jan-1-2019', '/Jan-(.*)-2019/'); // returns true
```

**str\_validate**

A simple way to use validate a string using Laravel's built-in validation system.

```
str_validate('calebporzio@aol.com', 'regex:/\.net$/|email|max:10');
// returns: ["Format is invalid.", "May not be greater than 10 characters."]

Str::validate('calebporzio@aol.com', 'regex:/\.net$/|email|max:10');
// returns: ["Format is invalid.", "May not be greater than 10 characters."]
```

**str\_wrap**

```
str_wrap('thing', '--'); // returns "--thing--"

Str::wrap('thing', '--'); // returns "--thing--"
```

**swap**

This function swaps the values of two variables.

```
$startDate = '2040-01-01';
$endDate = '2020-01-01';

if ($endDate < $startDate) {
    swap($startDate, $endDate);
}

echo $startDate; // prints "2020-01-01"
echo $endDate; // prints "2040-01-01"
```

**tinker**

Kind of like `dd()`, but will open an `artisan tinker` terminal session with the variables you passed in, so you can play around.

```
$somethingYouWantToDebug = new StdClass;
tinker($somethingYouWantToDebug);
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](license.txt).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2254d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/921834?v=4)[Aris Ripandi](/maintainers/riipandi)[@riipandi](https://github.com/riipandi)

---

Top Contributors

[![riipandi](https://avatars.githubusercontent.com/u/921834?v=4)](https://github.com/riipandi "riipandi (8 commits)")

---

Tags

helperslaravellaravel-helperslaravel-packagelaravelhelpers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/riipandi-laravel-helpers/health.svg)

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

###  Alternatives

[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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