https://github.com/davidjeddy/normie
Wrapper library that provides normalized function interfaces for the PHP standard library.
https://github.com/davidjeddy/normie
Last synced: about 2 months ago
JSON representation
Wrapper library that provides normalized function interfaces for the PHP standard library.
- Host: GitHub
- URL: https://github.com/davidjeddy/normie
- Owner: davidjeddy
- License: mit
- Created: 2018-08-14T04:07:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-16T23:15:43.000Z (over 5 years ago)
- Last Synced: 2025-03-27T18:13:36.877Z (2 months ago)
- Language: PHP
- Homepage: https://github.com/davidjeddy/normie
- Size: 116 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Normie
## Badges
[](https://semaphoreci.com/davidjeddy/normie)
[](https://packagist.org/packages/davidjeddy/normie)
[](https://codecov.io/gh/davidjeddy/normie)[](https://packagist.org/packages/davidjeddy/normie)
[](https://packagist.org/packages/davidjeddy/normie)
[](https://packagist.org/packages/davidjeddy/normie)[](https://scrutinizer-ci.com/g/davidjeddy/normie/?branch=master)
[](https://scrutinizer-ci.com/g/davidjeddy/normie/build-status/master)
[](https://scrutinizer-ci.com/g/davidjeddy/normie/?branch=master)
[](https://scrutinizer-ci.com/code-intelligence)[](https://packagist.org/packages/davidjeddy/normie)
[](https://packagist.org/packages/davidjeddy/normie)
[](https://packagist.org/packages/davidjeddy/normie)## Contributors
- David J Eddy
## 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](./src/Atrings.php).
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](./src/Strings.php).
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](https://getcomposer.org):
php composer.phar require davidjeddy/Normie
## Library Under Development Setup```sh
# 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
```## Testing / Quality / Reporting Tools
#### Quality
##### php-cs-fixer
```sh
./vendor/bin/php-cs-fixer fix ./src
```##### phpmnd
```sh
./vendor/bin/phpmnd ./src/ --progress
```##### phpstan
```sh
./vendor/bin/phpstan analyse ./src --level 7
```##### phploc
```sh
./vendor/bin/phploc ./src --count-tests
```##### phpcpd
```sh
./vendor/bin/phpcpd ./src
```##### dephpend
```sh
./vendor/bin/dephpend metrics ./src
```##### churn
```sh
./vendor/bin/churn run src
```##### phpcf
```sh
./vendor/bin/phpcf ./src
```##### Roave no leakds
```sh
vendor/bin/roave-no-leaks ./tests
```#### Reporting
##### phpcs
```sh
./vendor/bin/phpcs -p ./src/ --colors --report=source --report-file=./reports/phpcs.txt
```##### phpmd
```sh
./vendor/bin/phpmd ./src html codesize,unusedcode,naming --reportfile ./reports/phpmd.html
```##### phpmetrics
```sh
./vendor/bin/phpmetrics --report-html=./reports ./src/
```#### Testing
##### phpunit
No xDebug
./vendor/bin/phpunit --bootstrap vendor/autoload.php ./tests
With xDebugphp ./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!> /usr/local/etc/php/conf.d/xdebug.ini