PHPackages                             fikrimi/laravel-helper - 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. fikrimi/laravel-helper

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

fikrimi/laravel-helper
======================

Yet Another Laravel Helper

v1(6y ago)155PHPPHP &gt;=7

Since Feb 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/fikrimi23/laravel-helper)[ Packagist](https://packagist.org/packages/fikrimi/laravel-helper)[ RSS](/packages/fikrimi-laravel-helper/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Yet another laravel helper
==========================

[](#yet-another-laravel-helper)

This is my personal Laravel helper and decided to published it, hopefully one of them become useful for someone somewhere. You can use it as a whole or just use your own `HelperServiceProvider` and copy paste what you need. If you think any function you think redundant, stupid or unusable just issue it.

It consists of 5 helper group.

- [General](#general)
- [Form](#form)
- [URL](#url)
- [String](#string)
- [Arbitrary](#arbitrary)

General
-------

[](#general)

### `array_keys_exists(array $keys, array $arr)`

[](#array_keys_existsarray-keys-array-arr)

It validate multiple keys is exists on array. All of the keys should exists or it will return false.

```
    $first = [
        'foo'    => 'foo',
        'bar'    => 'bar',
        'foobar' => 'foobar',
        'barfoo' => 'barfoo',
    ];

    array_keys_exists(['foo', 'bar'], $first); //true
    array_keys_exists(['foo', 'chill'], $first); //false
```

### `is_assoc(array $arr)`

[](#is_assocarray-arr)

Check if it is an associative array or not.

```
  ...

  $second = [1, 2, 3, 4, 5];

  $third = [
     1 => 'isone',
      2 => 'istwo',
  ];

  $fourth = [
      0 => 'isone',
      1 => 'istwo',
  ];

  is_assoc($first); //true
  is_assoc($second); //false
  is_assoc($third); //true
  is_assoc($fourth); //false
```

### `ddr()`

[](#ddr)

"Debug and Die but Readable", like `dd()` but it always convert to array first. So imagine dumping your model but it always `->toArray()` first so you can read it like a normal human being and still have the perks of `dd()` like collapse and such. It works on every Arrayble thing (to convert to array) or anything beside it (like dd).

### `dr()`

[](#dr)

Like `ddr()` above, but didn't die. so you could set up something like this

```
  dr($param);

  ...
  $param = x;
  ...

  dr($param);
  // or ddr($param) to make it die
```

### `round_up($number, $per = 500)` and `round_down($number, $per = 500)`

[](#round_upnumber-per--500-and-round_downnumber-per--500)

Ceil `$number` to its nearest `$per`, I should've set the `$per` to be configurable, maybe next time.

```
  round_up(10200, 500); // 10500
  round_up(910, 900); // 990

  round_down(10200, 500); // 10000
  round_down(910, 900); // 900
```

### `bind_sql(Illuminate\Database\Query\Builder\Builder $builder)`

[](#bind_sqlilluminatedatabasequerybuilderbuilder-builder)

This one is useful for debugging. Its like `->toSql()` but it will bind all the required parameters. It need builder, so it must be before the query is executed (like before `->first()` or `->get()`).

```
  User::select()
    ->where('id', 5)
    ->toSql();

  // SELECT * FROM `users` where `id` = ?

  $user = User::select()
    ->where('id', 5);

  bind_sql($user);

  // SELECT * FROM `users` where `id` = 5
```

But my true intention is actually using it for subquery, imagine you can use the JOIN subquery but still having the advanted of query builder.

```
  $books = \App\Books::select([
    'author_id'
  ])
    ->selectRaw('COUNT(*) as release_count')
    ->where('release_date', '>=', '1990-01-01')
    ->groupBy('author_id');

  dd([
    \App\Author::select([
      'author_id'
    ])
      ->selectRaw('COUNT(release_count) as releases')
      ->join(DB::raw('(' . bind_sql($books) . ') as books'), 'author_id', 'authors.id')
      ->groupBy('company_id')
      ->get()
  ]);
```

In above example we try to use subquery of `Books` to try and join with its Authors, and group it again to get their company releases count. Maybe this is not an appropriate example, but you get the idea, to convert a query builder to its SQL-binded form and join it raw with other query builder.

### `array_insert_before(array $array, $key, array $new)`

[](#array_insert_beforearray-array-key-array-new)

Insert new element before `$key`

```
  $first = [
    'one', 'two', 'three',
  ];

  array_insert_before($first, 1, [
    'one and half',
  ]);

  // [
  // 'one',
  // 'one and half',
  // 'two,
  // 'three',
  // ]
```

Form
----

[](#form)

String
------

[](#string)

Url
---

[](#url)

Arbitrary
---------

[](#arbitrary)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~220 days

Total

2

Last Release

2066d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/108c9612dae54491a909f490123cd0063cd6710adae88a07da2f34fcaf539079?d=identicon)[fmiqbal](/maintainers/fmiqbal)

---

Top Contributors

[![fmiqbal](https://avatars.githubusercontent.com/u/8409391?v=4)](https://github.com/fmiqbal "fmiqbal (12 commits)")

### Embed Badge

![Health badge](/badges/fikrimi-laravel-helper/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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