Helper Functions for the laravel Framework
This package contains display formatting helpers for your php project., (*1)
all functions are called as static functions. Some examples:, (*2)
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);
After updating composer, add the ServiceProvider to the providers array in config/app.php, (*3)
Hansvn\Helper\ServiceProvider::class,
You can optionally use the facade for shorter code. Add this to your facades:, (*4)
'Helper' => Hansvn\Helper\Facade::class
After updating composer add the following lines to register provider in bootstrap/app.php
, (*5)
$app->register(\Hansvn\Helper\ServiceProvider::class);
, (*6)
To change the configuration, copy the config file to your config folder and enable it in bootstrap/app.php
:, (*7)
$app->configure('helper');
, (*8)
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:, (*9)
php artisan vendor:publish --tag=config --provider="Hansvn\Helper\ServiceProvider"
There are serveral functions in this package (represented with the parameters of the functions definition):, (*10)
formatDate($date, $format = null)
isJson($string)
cast($obj, $to_class)
toBase64($directory, $file = null, $with_mime = false)
timeSince($date, $now = null)
truncate($text, $length = 100, $options = array())
mime($extension, $default = 'application/octet-stream')
checkForFolder($folder, $permissions = 0775)
is_serialized($string)
maxFileUploadSize()
hex2rgb($hex)
The MIT License (MIT). Please see License File for more information., (*11)