1. Go to this page and download the library: Download hatamiarash7/laravel-utils 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/ */
hatamiarash7 / laravel-utils example snippets
use Hatamiarash7\Utils\StringUtils;
// Remove given words from a string. Pass them as array.
StringUtils::removeWords($words, $string);
// Return length of string. Normal or UTF-8.
StringUtils::len($string);
// Convert all characters to lowercase.
StringUtils::lowercase($string);
// Convert all characters to uppercase.
StringUtils::uppercase($string);
// Count the number of substring occurrences.
StringUtils::subCount($haystack, $needle);
// Summarize a string by limit. You can use end string for summarized string.
StringUtils::summarize($content, $max_characters = 100, $append = " ...")
// Convert English letters to Persian.
StringUtils::toPersian($expression)
// Convert numeral string to Persian price format.
StringUtils::toPersianPrice($expression)
use Hatamiarash7\Utils\ArrayUtils;
// Remove the duplicates from an array.
ArrayUtils::unique($array, $keepKeys = false);
// Check is key exists and return value.
ArrayUtils::key($key, $array, $returnValue = false);
// Check is value exists in the array and return key.
ArrayUtils::exists($value, array $array, $returnKey = false);
// Returns the first element in an array.
ArrayUtils::first(array $array);
// Returns the last element in an array.
ArrayUtils::last(array $array);
// Returns the first key in an array.
ArrayUtils::firstKey(array $array);
// Returns the last key in an array.
ArrayUtils::lastKey(array $array);
// Searches for a given value in an array of arrays, objects and scalar values.
ArrayUtils::search(array $array, $search);
// Add a prefix to each key of array.
ArrayUtils::addPrefix(array $array, $prefix);
use Hatamiarash7\Utils\VariableUtils;
// Smart convert string to int.
ArrayUtils::int($value);
// Return only digits chars of a string.
ArrayUtils::digits($value);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.