A package for handling numbers in Laravel.
You can install the package via composer:
composer require worksome/number
use Worksome\Number\Number;
$number = Number::of(100);
$number->mul(Number::of(5));
echo $number; // 500
This package also provides GraphQL scalar types for the WebOnyx GraphQL PHP package / Lighthouse.
These should be auto-registered by Worksome\Number\Providers\NumberServiceProvider
, however if you want to do this manually, they can be registered in the type registry using:
use Worksome\Number\GraphQL\Scalars\PercentageType;
use Worksome\Number\GraphQL\Scalars\StrictPercentageType;
// In Lighthouse (https://lighthouse-php.com)
$typeRegistry->register(new PercentageType());
$typeRegistry->register(new StrictPercentageType());
composer test
To update Pest snapshots, run the following:
vendor/bin/pest -d --update-snapshots
Please see GitHub Releases for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.