Download the PHP package davidjeddy/normie without Composer
On this page you can find all versions of the php package davidjeddy/normie. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davidjeddy/normie
More information about davidjeddy/normie
Files in davidjeddy/normie
Package normie
Short Description Attempt to normalize the PHP standard library array and string function parameter order.
License MIT
Informations about the package normie
Normie
Badges
Contributors
- David J Eddy [email protected]
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 arraymap ( 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: array explode ( string $string , string $delimiter [, int $limit = PHP_INT_MAX ] )
Install
Via Composer:
php composer.phar require davidjeddy/Normie
Library Under Development Setup
Testing / Quality / Reporting Tools
Quality
php-cs-fixer
phpmnd
phpstan
phploc
phpcpd
dephpend
churn
phpcf
Roave no leakds
Reporting
phpcs
phpmd
phpmetrics
Testing
phpunit
No xDebug
./vendor/bin/phpunit --bootstrap vendor/autoload.php ./tests
With xDebug
php ./vendor/bin/phpunit ./tests --coverage-clover './reports/clover.xml'
Usage
Usage is easy! Add the namespace declaration to your logic, then any time you want to use a normilized
version of a function you know add norm_
to the beginning. Now all array and string function parameters are in a predicatable order!
<?php
namespace Your\Class\Name;
...
use Normie\Array;
use Normie\String;
...
// some code for your application
...
$results = norm_stristr($heystack, $key);
...
xDebug
For some reporting / QA xDebug is needed. To do this execute the following:
docker run -it --rm --name normie -v "$PWD":/app php:7.4.0-jessie bash
pecl install xdebugphp
echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" >> /usr/local/etc/php/conf.d/xdebug.ini