Download the PHP package abollinger/helpers without Composer
On this page you can find all versions of the php package abollinger/helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abollinger/helpers
More information about abollinger/helpers
Files in abollinger/helpers
Package helpers
Short Description A set of useful functions for managing the Partez framework, but not only!
License MIT
Informations about the package helpers
Abollinger/Helpers
Provides some usefull PHP functions to help developpers in their daily work.
Getting started
Installation
You can easily add this library in your project using Composer:
Or add it manually in your file.
Usage
Here are all the function you can, showd in the Classes tree they belong to:
Functions in the Classes tree
- Abollinger/
- Helpers::
- cleanArray($array)
- printArray($array, $classes)
- defaultParams($default, $array)
- getYaml($filePath)
- getScan($dir, $rootDir, $allData)
- isAssociativeArray($array)
- largestElementInArray($array)
- defineConstants($array)
- getAppSubdirectory($appRoot, $documentRoot)
- getAppCompleteHost()
- Parsedown::
- extends the erusev/parsedown library
- Helpers::
cleanArray
Function that clean an array of parameters using the htmlspecialchars functions, to avoid the risk of XSS attacks.
- : The array that is to be cleaned.
- : The cleaned array. Returns false if @param is not an array.
Example :
printArray
Render PHP array into a HTML ul list
- : The array to render as a list.
- : A array of classes to apply to the ul/li. Expecting ["ul" => "classForTheUlTag", "li" => "classForTheLiTag"].
- : Default return is an empty string, else it's a HTML ul list of the array.
Example :
defaultParams
Function that create an array of default value that will be replace by the client value when exist
- : an array of default values that are necessary but not mandatory on client side.
- : an array of parameters mandatories that will be filled with the default values.
- : the array $params filled with default values.
Example:
getYaml
Yaml files reader returning the content as a array. Base on Symfony/Yaml package.
- : The path to the YAML file.
- : Return a PHP array of the YAML file content.
getScan
Scan a directory and return an array of all paths. Escape the .class.php files.
- : Directory to scan.
- : Root of the directory. Initially $dir = $rootDir, but in the loop $dir will change.
- : Array of all detailles path/files. Not nested.
isAssociativeArray
Function that evaluate if an array is Associative (ex.: ["key1" => "value1", "key2" => "value2"]) or not (["value1", "value2"]).
- : An array to be evaluated.
- : True if the array is associative, false otherwise.
largestElementInArray
Function that determine the max lenght among elements of an array
- : An array to be evaluated.
- : The max lenght.
defineConstants
Defines constants from an associative array if they are not already defined.
- : An associative array containing constant names as keys and their respective values.
- : Returns true if constants are defined or if the input is not an array. Returns false otherwise.
getAppSubdirectory
Function that returns the subdirectory path of an application relative to the document root.
- : The path to the application's root directory.
- : The path to the document root directory.
- : The subdirectory path or an empty string if the document root is longer than or equal to the application root.
getAppCompleteHost
This function returns the complete host URL of the current application.
- : The complete host URL of the current application.
Parsedown
Extends the erusev/parsedown library by adding # in the title, so the anchor links can work.
Classes tree
Licence
This library is licensed under the MIT License. For full license details, see the LICENCE
file distributed with this source code.
Author
Antoine Bollinger Email: [email protected]
For contributions, issues, or feedback, feel free to contact the author or open a GitHub issue.