Normie (short for Normalizer) attempts to make using the PHP Standard Library (SPL) function calls more consistent by implementing a norm_{function name}() wrapper function declarations. This library DOES NOT over ride the SPL functions in any way.
Examples
Function parameter order examples.
Arrays fn()
Normie array functions follow the 'array source X, operator Y (callback,key, needle, etc), other parameters are Z' mentality. The complete list of array functions are viewable here.
Normie string functions follow the 'Search X string or Y target, replace with Z string' mentality. The complete list of string functions are viewable here.
One day I'll remember the parameter order of functions like
strpos
,in_array
andarray_search
. That day is not today.Some of them use needle first, some of them haystack. But I always find myself reaching for php.net because for the life of me I can't remember.
I got tired of that as well, so I made this:
davidjeddy / normie
Wrapper library that provides normalized function interfaces for the PHP standard library.
Normie
Badges
Contributors
Description
Normie (short for Normalizer) attempts to make using the PHP Standard Library (SPL) function calls more consistent by implementing a norm_{function name}() wrapper function declarations. This library DOES NOT over ride the SPL functions in any way.
Examples
Function parameter order examples.
Arrays fn()
Normie array functions follow the 'array source X, operator Y (callback,key, needle, etc), other parameters are Z' mentality. The complete list of array functions are viewable here.
SPL: array array_map ( callable $callback, array $arr1, array $_ = null) { }
Normie: array norm_array_map( array $array, callable $callback, array $userdata = null): array
Strings fn()
Normie string functions follow the 'Search X string or Y target, replace with Z string' mentality. The complete list of string functions are viewable here.
SPL: array explode ( string $delimiter , string $string [, int $limit = PHP_INT_MAX ] )
…
"...Normie string functions follow the 'Search X string or Y target, replace with Z string' mentality..."
Feel free to use it and provide any feedback.