Download the PHP package mll-lab/php-utils without Composer
On this page you can find all versions of the php package mll-lab/php-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mll-lab/php-utils
More information about mll-lab/php-utils
Files in mll-lab/php-utils
Package php-utils
Short Description Shared PHP utility functions of MLL
License MIT
Homepage https://github.com/mll-lab/php-utils
Informations about the package php-utils
php-utils
Shared PHP utility functions of MLL
Installation
Install through composer
Usage
See tests.
SafeCast
PHP's native type casts like (int) and (float) can produce unexpected results, especially when casting from strings.
The SafeCast utility provides safe alternatives that validate input before casting:
Each type has two variants:
toX(): returns the cast value or throws\InvalidArgumentExceptiontryX(): returns the cast value ornull(likeEnum::tryFrom())
See tests for more examples.
Holidays
You can add custom holidays by registering a method that returns a map of holidays for a given year. Set this up in a central place that always runs before your application, e.g. a bootstrap method.
Custom holidays have precedence over the holidays inherent to this library.
PHPStan extension
This library provides a PHPStan extension that is either registered through PHPStan Extension Installer
or registered manually by adding the following to your phpstan.neon:
Requires spaze/phpstan-disallowed-calls.
Changelog
See CHANGELOG.md.
Contributing
See CONTRIBUTING.md.
License
This package is licensed using the MIT License.
All versions of php-utils with dependencies
ext-calendar Version *
ext-simplexml Version *
illuminate/support Version ^8.73 || ^9 || ^10 || ^11 || ^12
mll-lab/str_putcsv Version ^1
nesbot/carbon Version ^2.62.1 || ^3
ramsey/uuid Version ^3 || ^4
thecodingmachine/safe Version ^1 || ^2 || ^3