[!WARNING]
Github has shown it does not respect its users. Other have said it better than I can.
- https://www.theregister.com/2022/06/30/software_freedom_conservancy_quits_github/
- https://www.andrlik.org/dispatches/migrating-from-github-motivation/
- https://techresolve.blog/2025/12/27/looking-to-migrate-company-off-github-whats-the/
- https://lord.io/leaving-github/
- https://dev.to/alanwest/how-to-actually-migrate-from-github-to-codeberg-without-losing-your-mind-33bf>
Development has moved to Codeberg: ➡️ https://codeberg.org/DavidJEddy/normie
Please update your remotes:
git remote set-url origin https://codeberg.org/DavidJEddy/normie
Latest Stable Version Latest Unstable Version composer.lock
Scrutinizer Code Quality Build Status Code Coverage Code Intelligence Status
Monthly Downloads Daily Downloads Total Downloads
- David J Eddy me@davidjeddy.com
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.
Function parameter order examples.
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
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 ] )
Via Composer:
php composer.phar require davidjeddy/Normie
# Download repo and runtime environment git clone https://github.com/davidjeddy/normie.git cd ./normie docker pull php:7.4.0-cli docker run -d --rm --name php7_4 -v $(pwd):/normie php:7.4.0-cli tail -f /dev/null # Tools to make composer work a bit easier apt-get update -y apt-get install -y git zip unzip # Run a PHP environment docker exec -it php7_4 bash # Install deps cd /normie php composer.phar self-update php composer.phar install --dev -vvv -o # OR php composer.phar update -vvv -o
./vendor/bin/php-cs-fixer fix ./src
./vendor/bin/phpmnd ./src/ --progress
./vendor/bin/phpstan analyse ./src --level 7
./vendor/bin/phploc ./src --count-tests
./vendor/bin/phpcpd ./src
./vendor/bin/dephpend metrics ./src
./vendor/bin/churn run src
./vendor/bin/phpcf ./src
vendor/bin/roave-no-leaks ./tests
./vendor/bin/phpcs -p ./src/ --colors --report=source --report-file=./reports/phpcs.txt
./vendor/bin/phpmd ./src html codesize,unusedcode,naming --reportfile ./reports/phpmd.html
./vendor/bin/phpmetrics --report-html=./reports ./src/
No xDebug
./vendor/bin/phpunit --bootstrap vendor/autoload.php ./tests
With xDebug
php ./vendor/bin/phpunit ./tests --coverage-clover './reports/clover.xml'
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);
...
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