PHPackages                             lyhty/support - 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. lyhty/support

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

lyhty/support
=============

Adds some very convenient helpers to your Laravel project

v4.1.0(2w ago)07.5k↑21.9%1MITPHPPHP ^8.2

Since Jul 16Pushed 2w agoCompare

[ Source](https://github.com/lyhty/support)[ Packagist](https://packagist.org/packages/lyhty/support)[ Docs](https://matti.suoraniemi.com/lyhty/support)[ RSS](/packages/lyhty-support/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/070036f9976ad565270c181abd4d66fa352eb33d0237f4b125f6ae6c4d916030/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c796874792f737570706f72743f7374796c653d666c61742d737175617265266c6162656c3d266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/lyhty/support)[![PHP](https://camo.githubusercontent.com/38213e9d826a21e302d0d685e78da29117d54c6f3cd8c4670af44c0627213534/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c796874792f737570706f72743f7374796c653d666c61742d737175617265266c6162656c3d266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/lyhty/support)[![Laravel](https://camo.githubusercontent.com/c6252c8f96c72ebd2d4ac653eab468feaf0ba76504270a3d372e11324dd8f6ef/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d266d6573736167653d2535453132253230253743253230253545313326636f6c6f723d726564267374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/lyhty/support)[![Total Downloads](https://camo.githubusercontent.com/04731ca57f6458e9ae5fb13e7fb397abe172cbcf5377c91b824bdbf2f3205191/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c796874792f737570706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lyhty/support)[![License](https://camo.githubusercontent.com/77720d220d33d5f68ffea825772074c2f4a33c97cebce151b867d697fcb8d863/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c796874792f737570706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lyhty/support)

This package provides some additional, convenient helpers for you to use in your Laravel project.

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

[](#installation)

Install the package with Composer:

```
composer require lyhty/support

```

Features
--------

[](#features)

### Helpers

[](#helpers)

- `class_has_attribute(object|string $class, string $attribute): bool`
    - Return boolean value whether the given class has given attribute.
- `class_uses_trait(object|string $class, string $trait, bool $recursive = true): bool`
    - Return boolean value whether the given class uses given trait.
- `array_depth(array $array): int`
    - Return integer describing the max depth of the given array.
- `class_implements_interface(object|string $class, string $interface): bool`
    - Return boolean value whether the given class implements given interface.
- `class_extends(object|string $class, string $parent): bool`
    - Return boolean value whether the given class extends given parent class.
- `set_type(mixed $value, string $type): mixed`
    - Alias for 'settype' which allows non-variables as arguments.
- `trim_spaces(string $string): string`
    - Trim spaces from string.
- `not_null(mixed $var): bool`
    - !is\_null
- `get_bool(mixed $value): bool`
    - Get boolean value from given value. Accepts string true/false.
- `class_namespace(string $className): string`
    - Get namespace of given class.
- `___(array $keys, array $replace = [], array $numbers = [], string $locale = null, string $glue = ' '): string`
    - Translate given messages and glue them together.

### Discovery class

[](#discovery-class)

This is pretty much copied from `Illuminate\Foundation\Events\DiscoverEvents` from, just made more generic.

**Examples**

```
use Lyhty\Support\Discovery;

$all = Discovery::within('app\Models')->toArray();
// ["App\Models\User", "App\Models\BlogPost", "App\Models\Concerns\Taggable", "App\Models\Contracts\BlogWriter"]

$classes = Discovery::classesWithin('app\Models')->toArray();
// ["App\Models\User", "App\Models\BlogPost"]

$traits = Discovery::traitsWithin('app\Models')->toArray();
// ["App\Models\Concerns\Taggable"]

$interfaces = Discovery::interfacesWithin('app\Models')->toArray();
// ["App\Models\Contracts\BlogWriter"]

$usingClasses = Discovery::usesWithin('app\Models', 'App\Models\Concerns\Taggable')->toArray();
// ["App\Models\BlogPost"]

$implementingClasses = Discovery::implementsWithin('app\Models', 'App\Models\Contracts\BlogWriter')->toArray();
// ["App\Models\User"]

$extendingClasses = Discovery::extendsWithin('app\Models', 'Illuminate\Database\Eloquent\Model')->toArray();
// ["App\Models\User", "App\Models\BlogPost"]
```

License
-------

[](#license)

Lyhty Support is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance96

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

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

Recently: every ~105 days

Total

11

Last Release

17d ago

Major Versions

v1.0.0 → v2.0.02022-08-13

v2.2.0 → v3.0.02025-04-22

v3.0.1 → v4.0.02026-06-12

PHP version history (4 changes)v1.0.0PHP &gt;=7.1.3

v2.0.0PHP ^7.4 | ^8.0

v2.2.0PHP ^7.4 | ^8.0 | ^8.2

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2cd5d6f2caaea83278fd1552c5bdc1b30b4164890ba0801a718dc20efa93738c?d=identicon)[TruecapeDev](/maintainers/TruecapeDev)

---

Top Contributors

[![sirmathays](https://avatars.githubusercontent.com/u/37704147?v=4)](https://github.com/sirmathays "sirmathays (24 commits)")

---

Tags

helperslaravellaravelhelperssupport

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lyhty-support/health.svg)

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M203](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[laravel/folio

Page based routing for Laravel.

603583.7k33](/packages/laravel-folio)[illuminate/session

The Illuminate Session package.

9939.3M850](/packages/illuminate-session)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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