echron / tools
Tools library for PHP
Installs: 12 420
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=8.1
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.17.0
- phpmd/phpmd: ^2.12.0
- phpstan/phpstan: ^1.10.16
- phpunit/phpunit: ^10.1.2
- thecodingmachine/phpstan-safe-rule: ^v1.2.0
README
About
Echron PHP Tool library offers a set of handy classes and methods to simplify PHP development.
Installation
Install the latest version with
composer require echron/tools
Usage
Output seconds as human-readable string
echo \Echron\Tools\Time::readableSeconds(60 * 24); >> 24 minutes echo \Echron\Tools\Time::readableSeconds(60 + 3.4221580028534); >> 1 minute, 3.42 seconds echo \Echron\Tools\Time::readableSeconds(3.455669555); >> 3.46 seconds
Check if array has duplicates
$a = ArrayHelper::hasDuplicates(['red', 'green', 'purple']); print_r($a) >> false $b = ArrayHelper::hasDuplicates(['red', 'green', 'purple','red]); print_r($b) >> true
Filter array by unique values
$a = ArrayHelper::unique(['red', 'green', 'purple'],['orange','red']); print_r($a) >> ['red','green','purple','orange']