PHP code example of rishadblack / larahelpers

1. Go to this page and download the library: Download rishadblack/larahelpers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rishadblack / larahelpers example snippets


$randomNumber = generateRandomFloat(1.0, 10.0); // e.g., 5.23


$result = matchRouteParameter(['id' => 123]); // true or false based on the current request


$columnName = switchColLang('name', 'নাম'); // 'name' or 'নাম' based on locale


$options = perPageRows(); // [10, 25, 50, 100, 250]


$fields = addAllField($data); // [null => 'All', ...]


$symbol = currencySymbol(); // '৳'


$banglaNumber = numberEnToBn('123'); // '১২৩'


$url = asset_storage('uploads/file.jpg'); // URL for the asset


$faviconUrl = asset_favicon(); // URL for the favicon


$logoUrl = asset_logo(); // URL for the logo


$poweredLogoUrl = asset_powered_logo(); // URL for the powered logo


$darkLogoUrl = asset_dark_logo(); // URL for the dark logo


$profilePicUrl = asset_profile_picture(); // URL for the profile picture


$formatted = numberFormatConverted(12345.678, true); // '$12,345.68' or '৳12,345.68'


$percentage = percentFormat(0.256); // '25.60%'


$formattedPoint = pointFormat(1234.567, true); // '৳1,234.57'


$formattedUnit = unitFormat(5000, 'kg'); // '5,000kg'


$formattedNumber = numberFormat(1000); // '1,000.00'


$formattedValue = numberFormatOrPercent('20%'); // '20%'


$percentValue = getPercentOfValue('20%', 100); // 20


$value = getValueOfPercent('25%', 200); // 50


$formattedTime = getTimeFormat('now'); // e.g., '2024-10-05 15:00:00'


$jsTime = getTimeFormatJs('now'); // e.g., '2024-10-05T15:00:00Z'


$names = getfirstAndLastName('John Doe'); // ['John', 'Doe']


$size = getFolderSize('/path/to/folder'); // e.g., 2048


$formattedSize = getFormatSize(2048); // '2 KB'


$device = getCheckDevice(); // 'desktop'


$depth = getGenerateDepth(['a' => ['b' => ['c']]]); // 3


`$array` = convertPipeToArray('one|two|three'); // ['one', 'two', 'three']


$words = convertNumberToWordInEnglish(123); // 'one hundred twenty-three'


$banglaNumbers = getBanglaNumbers(123); // '১২৩'


$banglaWords = convertNumberToWordInBangla(123); // 'একশত তেইশ'

$randomNumber = generateRandomFloat(1.0, 10.0); // e.g., 5.23