yudhatp/laravel-helpers

Collection of helper functions for laravel

0.0.7 2024-03-27 21:55 UTC

This package is auto-updated.

Last update: 2024-10-27 23:19:55 UTC


README

Collection of (16) helper functions for Laravel 6.x, 7.x, 8.x, 9.x, 10,x.

Installation

You can install the package via composer:

composer require yudhatp/laravel-helpers

Usage

use Yudhatp\Helpers\Helpers;

//date helpers (7)
Helpers::indonesianDate("2022-11-28"); //28 November 2022
Helpers::indonesianShortDate("2022-11-28"); //28 Nov 22
Helpers::indonesianDayName("2022-11-29"); //Selasa
Helpers::indonesianMonthName("2022-11-29"); //November
Helpers::getAgeIndonesian("1945-08-17"); //77 Tahun, 3 Bulan, 12 Hari
Helpers::isWeekend("2022-11-29"); //false
Helpers::addDays("2022-11-28",2); //2022-11-30

//number helpers (4)
Helpers::terbilang("2000"); //Dua Ribu
Helpers::indonesianFormatDecimal("2,000.50"); //2.000,50
Helpers::calcIDFormatDecimal("2,000,000.50"); //2000000.50
Helpers::isPrime(2); //true

//string helpers(1)
Helpers::isPalindrome("level"); //true

//other helpers (4)
Helpers::indonesianPoliceNumberformat("B123XYZ"); //B 123 XYZ
Helpers::generatePassword(8); //EPp218kR
Helpers::filenameWithTimestamp("test","jpg"); //1669704266_test.jpg
Helpers::randomHexColor(); //#D15AF0

//blade
{{ (new \Yudhatp\Helpers\Helpers)->indonesianMonthName("2022-11-28") }}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.