PHP code example of w3lifer / php-helper

1. Go to this page and download the library: Download w3lifer/php-helper 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/ */

    

w3lifer / php-helper example snippets

 sh
composer req w3lifer/php-helper
 php
addChildrenToSimpleXMLElement(SimpleXMLElement $simpleXMLElement, array $children): void

addPrefixToArrayKeys(array $array, string $prefix, bool $recursively = true): array

addPostfixToArrayKeys(array $array, string $postfix, bool $recursively = true): array

addZeroPrefix(string $value, int $order = 1): string

arrayToXml(array $data, SimpleXMLElement &$xmlData = null): string

auth(array $credentials): bool

clearAllCookies(): bool

public static function createRss(array $channelInfo, array $items): string

createSitemap(array $items, bool $addUrlsetTag = true): string

createSitemapIndex(array $items, bool $addSitemapindexTag = true): string

createSqlValuesString(array $values, string $valueWrapper = '"'): string

csvStringToArray(string $csvString, bool $removeFirstLine = false): array

filterListOfArraysByKeyValuePairs(array $inputArray, array $searchParams): array

getBase64Image(string $absolutePathToImage): string

getClassNameFromObject(object $object): string

getClassNameFromString(string $className): string

getDatesBetweenDates(string $startDate, string $endDate, string $format = 'Y-m-d'): array

getFilesInDirectory(string $pathToDirectory, bool $recursively = false, array $fileExtensions = [], &$result = []): array

getFullUrl(): string

getNormalizedDayOfWeek(int $dayOfWeek): int

getRandomWeightedElement(array $weightedValues)

getResponseHeader(string $header, array $response): string

getTimezoneOffset(string $timeZone): int

insertAfterKey(array $array, string $afterKey, string $key, string $new)

isAjax(): bool

mbUcfirst(string $string): string

parseCookies(string $cookiesString): array

prettyVarExportSoft(array $array): string

prettyVarExportHard(array $array): string

putArrayToCsvFile(string $filename, array $array): bool

quickSort(array $array): array

rangeGenerator(int $start, int $limit, int $step = 1): Generator

removeCookie(string $name): bool

removeDirectoryRecursively(string $pathToDirectory): bool

removeDuplicatesFromMultiDimensionalArray(array $array): array

secondsToTime(int $seconds): array

sortByDate(array $array, string $key, bool $asc = true): array

strRepeatWithSeparator(string $input, int $multiplier, string $separator = ''): string

tabDelimitedStringToArray(string $string): array

unzip(string $pathToArchive, string $extractTo)