misantron / php-utils
A collection of PHP utility classes.
2.0.0
2015-06-24 15:10 UTC
Requires
- php: >=5.4
- ext-mbstring: *
- ext-openssl: *
- cocur/slugify: ~1.0
Requires (Dev)
- apigen/apigen: ~4.0
- phpunit/phpunit: ~4.4
- satooshi/php-coveralls: dev-master
- squizlabs/php_codesniffer: ~2.0
README
Features
- Contains Array, String and Time helper utilities.
- Base encoding - UTF-8
- PSR-4 auto loading standard compatible.
Server requirements
- PHP version >= 5.4.
- MBString PHP extension.
- OpenSSL PHP extension.
External dependencies
- Slugify library
Installing
The preferred way to install is through Composer. Run this command to install the latest stable version:
$ composer require misantron/php-utils
or add
"misantron/php-utils": "dev-master"
to the require section of your composer.json.
Basic usage examples
use Utility\UArray; use Utility\UString; use Utility\UTime; $array = [ ['name' => 'Alex', 'age' => 25], ['name' => 'Sara', 'age' => 21], ['name' => 'John', 'age' => 28] ]; $string = '..C’est du français !'; $date1 = new \DateTime('2015-02-26 13:05'); $date2 = new \DateTime('2015-02-26 22:16'); $result1 = UArray::extractColumn($array, 'age'); $result2 = UString::slug($string); $result3 = UTime::secondsDiff($date1, $date2); var_dump($result1, $result2, $result3); [25, 21, 28]; 'c-est-du-francais'; 33060;