PHPackages                             alifahmmed/helpers-package - 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. alifahmmed/helpers-package

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

alifahmmed/helpers-package
==========================

A Laravel helper package for file uploads, slug generation, and JSON responses

1.1.1(5mo ago)063↓100%MITPHPPHP &gt;=8.1

Since Mar 30Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/s-m-alif-ahmmed/helpers-package)[ Packagist](https://packagist.org/packages/alifahmmed/helpers-package)[ Docs](https://github.com/s-m-alif-ahmmed/helpers-package)[ RSS](/packages/alifahmmed-helpers-package/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Helper Package for Laravel
==========================

[](#helper-package-for-laravel)

A versatile Laravel helper package providing utilities for **file uploads**, **slug generation**, **JSON responses**, **database export**, **unit conversion**, and more. Designed to speed up development by providing ready-to-use helpers and traits.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Helper Class](#helper-class)
    - [AllTraits](#alltraits)
- [Traits Included](#traits-included)
- [Unit Conversion](#unit-conversion)
- [License](#license)

---

Compatibility
-------------

[](#compatibility)

This package is compatible with modern versions of Laravel and PHP:

Laravel: 9.x, 10.x, 11.x, and 12.x

PHP: 8.1 or higher

It leverages the latest features of PHP 8, including union types and improved type safety, and is fully compatible with Laravel’s service container, facades, and Eloquent ORM.

---

Features
--------

[](#features)

- File and image upload/delete in **public** or **storage**.
- Generate **unique slugs** for models.
- JSON responses for success, error, and paginated data.
- Export the full database with SQL file download.
- Apply filters and pagination to queries easily.
- Convert file paths to full URLs for API responses.
- Change model status or delete records with Livewire.
- Unit conversions: cm ↔ feet, kg ↔ lbs.
- Helper methods for testing and general utilities.

---

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

[](#installation)

Install via Composer:

```
  composer require alifahmmed/helpers-package:^1.1.1
```

Configuration

The package auto-registers the service provider and facade:

```
  'providers' => [
      AlifAhmmed\HelperPackage\HelperServiceProvider::class,
  ],

  'aliases' => [
      'Helper' => AlifAhmmed\HelperPackage\Helpers\Helper::class,
  ],
```

Usage

Helper Class

You can use the helper class directly for common tasks:

```
  use AlifAhmmed\HelperPackage\Helpers\Helper;

  // File upload
  $path = Helper::fileUpload($request->file('image'), 'posts', 'My Post Image');

  // File delete
  Helper::fileDelete('uploads/posts/my-post-image.jpg');

  // Generate unique slug
  $slug = Helper::makeSlug(Post::class, 'My Post Title');

  // JSON response
  return Helper::jsonResponse(true, 'Data fetched successfully', 200, $data);

  // JSON error response
  return Helper::jsonErrorResponse('Something went wrong', 400, ['field' => 'error']);
```

AllTraits

You can use AllTraits to include all package traits in any class:

```
  use AlifAhmmed\HelperPackage\Traits\AllTraits;

  class PostController extends Controller
  {
      use AllTraits;
  }
```

ApiResponse

```
  public function index()
  {
      $posts = Post::all();
      return $this->success('Posts fetched successfully', $posts);
  }

  public function show($id)
  {
      $post = Post::find($id);
      if (!$post) {
          return $this->error('Post not found', 404);
      }
      return $this->ok('Post fetched successfully', $post);
  }

  public function listWithPagination()
  {
      $posts = Post::paginate(10);
      return $this->pagination('Posts list', $posts);
  }

  public function customPaginationExample()
  {
      $posts = Post::paginate(5);
      return $this->successPagination(true, 'Data fetched', 200, $posts, true);
  }
```

DatabaseExportable

```
  public function export()
  {
      return $this->exportDatabase();
  }
```

FileManager

```
  // Upload files to public folder
  public function uploadFiles(Request $request)
  {
      $paths = $this->uploadToPublic($request->file('images'), 'posts');
      return response()->json($paths);
  }

  // Delete files from public folder and update DB
  public function deleteFiles(Post $post)
  {
      $this->deleteFromPublic($post, 'images');
  }

  // Upload files to storage folder
  public function uploadToStorageExample(Request $request)
  {
      $paths = $this->uploadToStorage($request->file('documents'), 'docs');
      return response()->json($paths);
  }

  // Update files in public folder (delete old + upload new)
  public function updateFiles(Post $post, Request $request)
  {
      $paths = $this->updateToPublic($post, 'images', $request->file('images'), 'posts');
      return response()->json($paths);
  }
```

HasFilter

```
  public function index(Request $request)
  {
      $query = Post::query();
      $query = $this->applyFilters($query, $request);
      $limit = $this->getLimit($request, 10);
      $posts = $query->paginate($limit);

      return response()->json($posts);
  }
```

ImagePathTrait

```
  public function show(Post $post)
  {
      $post->image_url = $this->fullImageUrl($post->image);
      return response()->json($post);
  }

  // Only convert for API routes
  public function showApi(Post $post)
  {
      $post->image_url = $this->fullImageUrlForApi($post->image);
      return response()->json($post);
  }
```

SlugGenerator

```
  $slug = $this->generateSlug(Post::class, 'slug', $request->title);
```

TestPerpose

```
  return $this->testPerpose();
```

Unit Conversion

```
  $this->cmToFeet(180);  // 5.9055
  $this->feetToCm(5.9);  // 179.83
  $this->kgToLbs(70);    // 154.32
  $this->lbsToKg(154);   // 69.85
```

License

MIT License © S M Alif Ahmmed

Contribution

Feel free to contribute by submitting issues or pull requests on GitHub.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance70

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Total

3

Last Release

175d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3af3c0ae537b65ab45f1b6cf345dc00327e959377c8a1be855884807b4db0e1e?d=identicon)[s-m-alif-ahmmed](/maintainers/s-m-alif-ahmmed)

---

Top Contributors

[![s-m-alif-ahmmed](https://avatars.githubusercontent.com/u/115633805?v=4)](https://github.com/s-m-alif-ahmmed "s-m-alif-ahmmed (10 commits)")

---

Tags

laravelhelperpackagefile-uploadJSON responsesslug generation

### Embed Badge

![Health badge](/badges/alifahmmed-helpers-package/health.svg)

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

###  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)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)

PHPackages © 2026

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