worksome / number
A package for handling numbers in Laravel
Fund package maintenance!
worksome
Installs: 270 611
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 13
Forks: 1
Open Issues: 0
Requires
- php: ^8.2
- brick/math: ^0.9.3 || ^0.10 || ^0.11
- nuwave/lighthouse: ^6.36
- webonyx/graphql-php: ^15.2.1
Requires (Dev)
- larastan/larastan: ^2.6
- nunomaduro/collision: ^7.0 || ^8.1
- orchestra/testbench: ^8.0 || ^9.0
- pestphp/pest: ^2.34
- worksome/coding-style: ^2.10
README
A package for handling numbers in Laravel.
Installation
You can install the package via composer:
composer require worksome/number
Usage
use Worksome\Number\Number; $number = Number::of(100); $number->mul(Number::of(5)); echo $number; // 500
GraphQL
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());
Testing
composer test
Updating snapshots
To update Pest snapshots, run the following:
vendor/bin/pest -d --update-snapshots
Changelog
Please see GitHub Releases for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.