PHPackages                             ryangjchandler/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. ryangjchandler/laravel-helpers

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

ryangjchandler/laravel-helpers
==============================

A collection of helper functions that I use across my projects.

v0.7.0(1y ago)354651MITPHPPHP ^8.2

Since Jul 18Pushed 1y ago1 watchersCompare

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

READMEChangelog (9)Dependencies (8)Versions (11)Used By (0)

A collection of helper functions that I use across my projects.
===============================================================

[](#a-collection-of-helper-functions-that-i-use-across-my-projects)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b0eabcc16ff1f3ac0205d4fdde12e0073d0d70f93c143d1f45e3a5c986c994d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7279616e676a6368616e646c65722f6c61726176656c2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ryangjchandler/laravel-helpers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0baa103b8966f31b6041bd7d161bb190dccca27f622260c7ce0002845f74d13a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7279616e676a6368616e646c65722f6c61726176656c2d68656c706572732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/ryangjchandler/laravel-helpers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/80c81dc0ed69f8d05586c3c8c35e82ab0849a431830d90ae3e4980a4d3a2e7d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7279616e676a6368616e646c65722f6c61726176656c2d68656c706572732f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/ryangjchandler/laravel-helpers/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1b08e38e4bb6a1d0f11bf131dff75ea1b853a1866b82c9b3e13f7c1c5b1aae95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7279616e676a6368616e646c65722f6c61726176656c2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ryangjchandler/laravel-helpers)

This package includes some of the helper functions that I tend to use in all of my projects.

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

[](#installation)

You can install the package via composer:

```
composer require ryangjchandler/laravel-helpers
```

Usage
-----

[](#usage)

### `user`

[](#user)

Returns the current user, or null depending on authentication status.

> This function assumes that your `User` model is found inside of `app/Models` and will not be registered if that class doesn't exist.

```
$user = user();
```

### `route_is`

[](#route_is)

Check if the current route name matches the provided string.

```
route_is('dashboard.index');
```

### `authorize`

[](#authorize)

Identical to Laravel's `$this->authorize()` method provided by the `AuthorizesRequests` trait.

```
public function index()
{
    authorize('viewAny', Post::class);
}
```

### `attributes()` and `@attributes`

[](#attributes-and-attributes)

Laravel 9 introduces new directives for checked, disabled and selected. In some cases though, you might want to output a variety of different attributes using PHP values.

`attributes()` and the `@attributes()` directive can help with that:

```
 ! $user->can('click'),
])>

```

### `mdash()`

[](#mdash)

It's quite common to output an `&mdash;` in your HTML code when it isn't present. Doing this with regular Blade `{{ }}` tags can be annoying though since `&mdash;` needs to be output in "raw" mode.

This function uses `HtmlString` to return a "safe" wrapper around the HTML entity which allows it to be output without being escaped.

```
{{ $post->published_at?->format('d/m/Y') ?? mdash() }}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ryan Chandler](https://github.com/ryangjchandler)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~145 days

Recently: every ~277 days

Total

9

Last Release

600d ago

PHP version history (2 changes)v0.1.0PHP ^8.0

v0.7.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/568d485d441c691b0358b9091254a6a671fef8f76b73f28af1180ad568d142b2?d=identicon)[ryangjchandler](/maintainers/ryangjchandler)

---

Top Contributors

[![ryangjchandler](https://avatars.githubusercontent.com/u/41837763?v=4)](https://github.com/ryangjchandler "ryangjchandler (38 commits)")

---

Tags

laravelryangjchandlerlaravel-helpers

###  Code Quality

TestsPest

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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