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

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

hansvn/laravel-helper
=====================

Helper Functions for the laravel Framework

v0.1.2(8y ago)11.1kMITPHPPHP &gt;=5.5.0

Since Nov 4Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

Helper functions for PHP frameworks
-----------------------------------

[](#helper-functions-for-php-frameworks)

This package contains display formatting helpers for your php project.

### Usage

[](#usage)

all functions are called as static functions. Some examples:

```
Helper::formatDate($date);
Helper::isJson($json_string);
Helper::cast($object, $to_class_name);
Helper::toBase64($filename);
Helper::timeSince($date);
Helper::truncate($really_long_string);
Helper::mime($file_extension);
Helper::checkForFolder($folder_path);
Helper::is_serialized($string_to_check);
Helper::maxFileUploadSize();
Helper::hex2rgb($hexadecimal_string);
```

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

[](#installation)

### Laravel 5.x:

[](#laravel-5x)

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
Hansvn\Helper\ServiceProvider::class,

```

You can optionally use the facade for shorter code. Add this to your facades:

```
'Helper' => Hansvn\Helper\Facade::class

```

### Lumen:

[](#lumen)

After updating composer add the following lines to register provider in `bootstrap/app.php`

```
$app->register(\Hansvn\Helper\ServiceProvider::class);

```

To change the configuration, copy the config file to your config folder and enable it in `bootstrap/app.php`:

```
$app->configure('helper');

```

### Configuration

[](#configuration)

The defaults configuration settings are set in `config/helper.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:

```
php artisan vendor:publish --tag=config --provider="Hansvn\Helper\ServiceProvider"

```

### Functions

[](#functions)

There are serveral functions in this package (represented with the parameters of the functions definition):

- formatDate: function to format a date
    - `formatDate($date, $format = null)`
- isJson: check if a given string is json
    - `isJson($string)`
- cast: cast object to an(other) class
    - `cast($obj, $to_class)`
- toBase64: base64 encode files
    - `toBase64($directory, $file = null, $with_mime = false)`
- timeSince: display the difference in time in a human readable form
    - `timeSince($date, $now = null)`
- truncate: cut a text to specified length and add three dots ('...') at the and of the string
    - `truncate($text, $length = 100, $options = array())`
- mime: Get the mime type from file extension
    - `mime($extension, $default = 'application/octet-stream')`
- checkForFolder: Check if a folder exists and create if not exists
    - `checkForFolder($folder, $permissions = 0775)`
- is\_serialized: Check if a string is serialized
    - `is_serialized($string)`
- maxFileUploadSize: Get the maximum file upload size (in MB) allowed by the sever
    - `maxFileUploadSize()`
- hex2rgb: Convert a hexadecimal color to their rgb values
    - `hex2rgb($hex)`

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

3082d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.1.2PHP &gt;=5.5.0

### Community

Maintainers

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

---

Tags

laravelhelper

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/hansvn-laravel-helper/health.svg)](https://phpackages.com/packages/hansvn-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)[cartalyst/support

Support helpers.

762.8M14](/packages/cartalyst-support)

PHPackages © 2026

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