PHPackages                             abdullah-mateen/laravel-helping-metarial - 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. abdullah-mateen/laravel-helping-metarial

Abandoned → [abdullah-mateen/laravel-helping-material](/?search=abdullah-mateen%2Flaravel-helping-material)Library[Utility &amp; Helpers](/categories/utility)

abdullah-mateen/laravel-helping-metarial
========================================

Laravel helper functions and general helping material

v2.0.6(1y ago)044MITPHPPHP ^8.1

Since Feb 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AbdullahMateen/laravel-helping-material)[ Packagist](https://packagist.org/packages/abdullah-mateen/laravel-helping-metarial)[ RSS](/packages/abdullah-mateen-laravel-helping-metarial/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (14)Used By (0)

[![Laravel Helping Material](./images/banner.png)](./images/banner.png)

[![Total Downloads](https://camo.githubusercontent.com/4abc2c821032041e1a3061042fa76e18da45c2337a174047254ea8dba573a13c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264756c6c61682d6d617465656e2f6c61726176656c2d68656c70696e672d6d6574617269616c2e737667)](https://packagist.org/packages/abdullah-mateen/laravel-helping-metarial)[![GitHub issues](https://camo.githubusercontent.com/c04770870f80e8469d946e1e9fc3f55a10b67271d8690712da285db72c3c5182/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f416264756c6c61684d617465656e2f6c61726176656c2d68656c70696e672d6d6174657269616c2e737667)](https://github.com/AbdullahMateen/laravel-helping-material/issues)[![GitHub stars](https://camo.githubusercontent.com/fa192448d76e45c4a11dceca60863e2f3e255279be68a934a0afad414b8e6b20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f416264756c6c61684d617465656e2f6c61726176656c2d68656c70696e672d6d6174657269616c2e7376673f7374796c653d736f6369616c)](https://github.com/AbdullahMateen/laravel-helping-material)[![GitHub forks](https://camo.githubusercontent.com/c26a0ec6b7aaef6c86fd0fc56106ef969b1939188ae4bd04b2d9f999543d71b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f416264756c6c61684d617465656e2f6c61726176656c2d68656c70696e672d6d6174657269616c2e7376673f7374796c653d736f6369616c)](https://github.com/AbdullahMateen/laravel-helping-material/network)[![GitHub watchers](https://camo.githubusercontent.com/9a4ac859da1540da3f9cff850d1de1428d4954af4c518c0a9059cc900522794f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f77617463686572732f416264756c6c61684d617465656e2f6c61726176656c2d68656c70696e672d6d6174657269616c2e7376673f7374796c653d736f6369616c)](https://github.com/AbdullahMateen/laravel-helping-material/watchers)

Laravel Helping Material

[](#laravel-helping-material)

> This package is a collection of useful tools for Laravel developers. It includes helper functions for common tasks, enums for defining constants, helpful traits for models and controllers, laravel validation rules for custom validations, and a simple media upload library for handling file uploads. This package aims to make Laravel development easier and faster.

Table of contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Publish](#publish)
- [Usage](#usage)
    - [Enums](#enums)
    - [Helpers](#helpers)
    - [Interface](#interface)
    - [Middleware](#middleware)
    - [Models](#models)
    - [Resources](#resources)
    - [Resources](#resources)
    - [Rules](#rules)
    - [Simple Media Library](#simple-media-library)
- [Authors](#author)
- [License](#license)

Getting Started
---------------

[](#getting-started)

This package offers a variety of features to enhance your web development experience. Some of the features are:

- Enums: Define and use enum types in your code for better readability and consistency.
- Helpers: Use handy functions and macros to simplify common tasks and operations.
- Colors Interface: A list of colors classes and RGBA codes.
- Authorization Middleware: Protect your routes and controllers with customizable authorization logic.
- General Model: Use a base model class that provides common functionality and traits for your models.
- Helpful Css: Apply some useful css classes to your elements (if you are not using tailwind).
- Validation Rules: Validate your data with custom rules and messages.
- Some Helpful Traits: Use traits to add behavior and functionality to your enums, classes and controllers.
- Simple Media Library: Manage your media files and attachments with ease.

This package is designed to help you with your web development projects. We hope you find it useful and enjoyable.

Prerequisites
-------------

[](#prerequisites)

[(Back to top)](#table-of-contents)

This project requires PHP `(version 8.1 or later)` you can use [xampp](https://www.apachefriends.org/), [wamp](https://www.wampserver.com/en/), [laragon](https://laragon.org/index.html) or any other option that is suitable to you, they are really easy to install. To make sure you have them available on your machine, try running the following command.

```
$ php -v
8.1.6
```

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

[](#installation)

[(Back to top)](#table-of-contents)

Require this package with composer using the following command:

```
composer require abdullah-mateen/laravel-helping-material
```

Publish
-------

[](#publish)

[(Back to top)](#table-of-contents)

You can use the publish command to publish all the files. This will allow you to modify the files as you wish. To publish your files, you need to execute this command in `PowerShell`, `cmd` or any other `terminal`.

```
php artisan lhm:publish
```

Once you run the above command it will display a menu of files to publish. You can select one or more files by typing their numbers separated by commas, as shown below:

[![Icone VS-Code](./images/lhm-publish-selection.png)](./images/lhm-publish-selection.png)

Usage
-----

[](#usage)

### Enums

[](#enums)

[(Back to top)](#table-of-contents)

This package is using `php` default enums which are available from `(PHP 8 >= 8.1.0)` onward.

DirEnumsDescriptionMediaMediaDiskEnum
MediaTypeEnumBoth `enums` are related to `Media` model which is also included in this package.
Mostly used in [`Simple Media Library`](#simple-media-library) which is documented belowUserAccountStatusEnum
GenderEnum
RoleEnumThese enums are related to `User` model which are mostly/commonly used wherever there is a userStatusEnumGeneral `Status` enum like to manage active/inactive statuses of a model#### Example

[](#example)

```
use \AbdullahMateen\LaravelHelpingMaterial\Enums\User\AccountStatusEnum;
use \AbdullahMateen\LaravelHelpingMaterial\Enums\User\GenderEnum;
use \AbdullahMateen\LaravelHelpingMaterial\Enums\User\RoleEnum;

class User extends Authenticatable {

    protected $casts = [
        'role'   => RoleEnum::class,
        'gender' => GenderEnum::class,
        'status' => AccountStatusEnum::class,
    ];

    // ...
}

User::create([
    'name'     => 'John Doe',
    'email'    => 'example@example.com',
    'password' => Hash::male('password'),
    'role'     => RoleEnum::Customer, // or you can use its value RoleEnum::Customer->value
    'gender'   => GenderEnum::Male, // or you can use its value GenderEnum::Male->value
    'status'   => AccountStatusEnum::Unverified, // or you can use its value AccountStatusEnum::Unverified->value
]);
```

> **Note:** if you are going to use these enums as values then you don't need to cast them to enums.

### Helpers

[](#helpers)

[(Back to top)](#table-of-contents)

*list of helper functions will be available soon.* For now you can have a look at available functions [here](https://github.com/AbdullahMateen/laravel-helping-material/tree/1.x/src/Helpers)

The helper functions are not automatically registered by default. To utilize these helper functions, you must first publish them using the command `php artisan lhm:publish` and select the helper functions options. Afterward, navigate to your `composer.json` file and perform the following steps:

```
{
  "autoload": {
    "files": [
      "src/Helpers/helpers.php"
    ]
  }
}
```

Finally, run the command `composer dump-autoload` or its shorthand `composer du` in your current directory terminal.

#### Example

[](#example-1)

```
$user = auth_user();

$routeName = route_url_to_name('https://example.com') // will return 'index'

if (is_current_route('dashboard')) {
    // do something
}

// and much more ...
```

### Interface

[](#interface)

[(Back to top)](#table-of-contents)

InterfaceDescriptionColorsInterfaceThis interface contain a list of `color classes` and `color codes` of those classes for this you also need `sass` file which contain those classes.
That `sass` file is included in this package#### Example

[](#example-2)

```
use \AbdullahMateen\LaravelHelpingMaterial\Interfaces\ColorsInterface;
use \AbdullahMateen\LaravelHelpingMaterial\Enums\User\AccountStatusEnum;

class Example implements ColorsInterface {

    protected $casts = [
        'status' => AccountStatusEnum::class,
    ];

    public function getColorClass() {
        return 'bg-' . self::SUCCESS_CLASS // bg-success: for background colors
        // return self::SUCCESS_CLASS // success: for text colors
    }

    public function getColorCode() {
        return self::SUCCESS // #28a745
    }

    public function getStatusColor() {
        return $this->status->color(); // Using Enum 'color' function
    }

}
```

> you can see another examples in-use in Enums [here](https://github.com/AbdullahMateen/laravel-helping-material/tree/1.x/src/Helpers)

### Middleware

[](#middleware)

[(Back to top)](#table-of-contents)

MiddlewareusageDescriptionAuthorizationMiddleware`authorize:1001,3001,5001`This middleware is used to authorize users based on their levels.The middleware is pre-registered, but if you have published it using the command `php artisan lhm:publish` and selected the middleware option, you will receive an overridden file for the same middleware. In such cases, it's necessary to manually register the middleware. To do so, follow these steps in the `app\Http\Kernel.php` file:

```
  // ...

  protected $routeMiddleware = [
      // ...

      'custom-authorize' => \App\Http\Middleware\Custom\AuthorizationMiddleware::class,
  ];
```

#### Example

[](#example-3)

```
// web.php File

use \AbdullahMateen\LaravelHelpingMaterial\Enums\User\RoleEnum;

Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('authorize:1001,3001')

Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('authorize:' . RoleEnum::column('value', 'admins', true))

// if you have published it
Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('custom-authorize:1001,3001')
```

> take a look at AuthorizationMiddleware [here](https://github.com/AbdullahMateen/laravel-helping-material/tree/1.x/src/Helpers)

### Models

[](#models)

[(Back to top)](#table-of-contents)

### Resources

[](#resources)

[(Back to top)](#table-of-contents)

### Rules

[](#rules)

[(Back to top)](#table-of-contents)

### Simple Media Library

[](#simple-media-library)

[(Back to top)](#table-of-contents)

Author
------

[](#author)

[(Back to top)](#table-of-contents)

- **[Abdullah Mateen](https://github.com/AbdullahMateen/laravel-helping-material)** - **

License
-------

[](#license)

[(Back to top)](#table-of-contents)

The MIT License (MIT) 2024 - [Abdullah Mateen](https://github.com/AbdullahMateen/laravel-helping-material). Please have a look at the [LICENSE.md](./LICENSE) for more details.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance48

Moderate activity, may be stable

Popularity8

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

Recently: every ~9 days

Total

12

Last Release

383d ago

Major Versions

1.x-dev → v2.0.02025-03-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/e332e823366218c8490fc011984e896bc2e1da107a74c215c451aa79c189d45a?d=identicon)[AbdullahMateen](/maintainers/AbdullahMateen)

---

Top Contributors

[![AbdullahMateen](https://avatars.githubusercontent.com/u/22071476?v=4)](https://github.com/AbdullahMateen "AbdullahMateen (95 commits)")

---

Tags

laravelhelpers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/abdullah-mateen-laravel-helping-metarial/health.svg)

```
[![Health](https://phpackages.com/badges/abdullah-mateen-laravel-helping-metarial/health.svg)](https://phpackages.com/packages/abdullah-mateen-laravel-helping-metarial)
```

###  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)
