DEV Community

Discussion on: My PHP Toolkit to Build a (quite) Frameworkless App

Collapse
 
david_j_eddy profile image
David J Eddy

Great list Boris! While I knew many of these it is good to see some I was not aware of. Would you have time to checkout a little library I put together?

davidjeddy / normie

Wrapper library that provides normalized function interfaces for the PHP standard library.

Normie

Badges

Build Status License codecov

Latest Stable Version Latest Unstable Version composer.lock

Scrutinizer Code Quality Build Status Code Coverage Code Intelligence Status

Monthly Downloads Daily Downloads Total Downloads

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 ] )

Collapse
 
biros profile image
Boris Jamot ✊ /

Hi David,

I don't use the SPL that much and honestly, its lack of consistency doesn't bother me.
I hope PHP8 will move this in the right way.

Anyway, you made a great job for the community by providing this library.