PHPackages                             allanmcarvalho/numerable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. allanmcarvalho/numerable

ActiveLibrary

allanmcarvalho/numerable
========================

This is my package numerable

1.3.1(2y ago)3387[4 PRs](https://github.com/allanmcarvalho/numerable/pulls)MITPHPPHP ^8.1CI passing

Since Nov 20Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/allanmcarvalho/numerable)[ Packagist](https://packagist.org/packages/allanmcarvalho/numerable)[ Docs](https://github.com/allanmcarvalho/numerable)[ RSS](/packages/allanmcarvalho-numerable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (9)Versions (15)Used By (0)

Numerable for Laravel
=====================

[](#numerable-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a8cbb81c974d884bd0de0dbc1ed9071b28562dee9ec46d59de088a6840bfbd8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6c616e6d63617276616c686f2f6e756d657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/allanmcarvalho/numerable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0debc2149a0c721f01ffa804649fb01fc2c6ac2634a12895613668e330724aa3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6c616e6d63617276616c686f2f6e756d657261626c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/allanmcarvalho/numerable/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3705b317ece297a5a2681dd116f9d3b403149b19ad2080de7fe401005bfa8bf5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6c616e6d63617276616c686f2f6e756d657261626c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/allanmcarvalho/numerable/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/93d62480ad5403a880b50e881999f8d9653909ba4672c5354355fc5a10a62c16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c6c616e6d63617276616c686f2f6e756d657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/allanmcarvalho/numerable)[![codecov](https://camo.githubusercontent.com/4eaf6b615a425e4221d34f03728ade297c4c3f01d3cec27aa6d0b782727898e6/68747470733a2f2f636f6465636f762e696f2f67682f616c6c616e6d63617276616c686f2f6e756d657261626c652f67726170682f62616467652e7376673f746f6b656e3d4a7a3065354562543164)](https://codecov.io/gh/allanmcarvalho/numerable)

This package provide a solution like Laravel strings utils classes. With it, you can do some cool stuffs in your numbers like assert, modify, math operations, format and other things.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require allanmcarvalho/numerable
```

Basic usage
-----------

[](#basic-usage)

Numerable is like Laravel string utils classes. You can use Helper class or an instance from numerable.

```
use Numerable\Numerable;
use Numerable\Number;

Number::add(2, 4, 6); // 12
Number::equal(2.0, 2); // true
Number::equal(2.0, 2, strict: true); // false
Number::divide(100, 2); // 50
Number::gt(10, 11); // false
Number::gte(11.0, 11); // true
Number::lt(10, 11); // true
Number::lte(11.0, 11); // true
Number::multiply(2, 10, 5); // 100
Number::parse('21.32%'); // 21.32
Number::sub(20, 4, 1); // 15
Number::toCurrency(213.21); // $213.21
Number::toFloat(1_000); // 1000.0
Number::toInteger(23.21); // 23
Number::toOrdinal(1); // 1st
Number::toPercentage(0.52, precision: 0); // 52%
Number::toReadableSize(1024 * 1024 * 512); // 512MB

//or

$number = Number::from(10)
    ->add(2) // now is 12
    ->divide(2.5) // now is 4.8
    ->multiplyBy(4) // now is 19.2
    ->sub(4); // now is 15.2

//or

$number = num(10)
    ->add(2) // now is 12
    ->divide(2.5) // now is 4.8
    ->multiplyBy(4) // now is 19.2
    ->sub(4); // now is 15.2

$number->equal(15.10); // false
$number->gt(10); // true
$number->gte(18); // false
$number->lt(10); // false
$number->lte(18); // true
$number->toCurrency(); // $15.20
$number->toCurrency('BRL', 'pt_BR'); // R$15,20
$number->toFloat(); // 15.2
$number->toFormat(places: 0, suffix: ' oranges'); // 15 oranges
$number->toInteger(); // 15
$number->toOrdinal(); // 15th
$number->toPercentage(sourceHumanized: true); // 15.00%
$number->toReadableSize(short: false); // 15.2 bytes

```

Available methods
-----------------

[](#available-methods)

- **abs** - Get absolute value. Available as static method and instance method.
- **add** - Add numbers. Available as static method and instance method.
- **asHumanPercentage** - Format number to human percentage. Available only as instance method.
- **asFractionPercentage** - Format number to fraction percentage. Available only as instance method.
- **equal** - Compare numbers. Available as static method and instance method.
- **diff** - Get difference between numbers. Available as static method and instance method.
- **divide** - Divide numbers. Available as static method and instance method.
- **divideBy** - Divide an instance value by a divisor. Available as instance method.
- **gt** - Check if number is greater than another number. Available as static method and instance method.
- **gte** - Check if number is greater than or equal to another number. Available as static method and instance method.
- **isEven** - Check if number is even. Available as static method and instance method.
- **isFloat** - Check if number is float. Available as static method and instance method.
- **isInteger** - Check if number is integer. Available as static method and instance method.
- **isMultipleOf** - Check if number is multiple of another number. Available as static method and instance method.
- **isNegative** - Check if number is negative. Available as static method and instance method.
- **isOdd** - Check if number is odd. Available as static method and instance.
- **isPositive** - Check if number is positive. Available as static method and instance method.
- **lt** - Check if number is less than another number. Available as static method and instance method.
- **lte** - Check if number is less than or equal to another number. Available as static method and instance method.
- **multiply** - Multiply numbers. Available as static method.
- **multiplyBy** - Multiply number by another number. Available as instance method.
- **parse** - Parse string to number. Available as static method.
- **round** - Round number. Available as static method and instance method.
- **roundAsMultipleOf** - Round number as multiple of another number. Available as static method and instance method.
- **sub** - Subtract numbers. Available as static method and instance method.
- **takeAPart** - Take a part of number. Available as static method and instance method.
- **toCurrency** - Format number to currency. Available as static method and instance method.
- **toFloat** - Format number to float. Available as static method and instance method.
- **toFormatted** - Format number to formatted string. Available as static method and instance method.
- **toInteger** - Format number to integer. Available as static method and instance method.
- **toOrdinal** - Format number to ordinal. Available as static method and instance method.
- **toPercentage** - Format number to percent. Available as static method and instance method.
- **variation** - Get variation between numbers. Available as static method.
- **variationFrom** - Get variation from a base number. Available as instance method.
- **variationTo** - Get variation to a base number. Available as instance method.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Allan Mariucci Carvalho](https://github.com/allanmcarvalho)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance56

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Recently: every ~28 days

Total

8

Last Release

787d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f933258a2b9bfecc0be13f8e6786c5c937e288fed34fea37054563da4bf02e8?d=identicon)[allanivp](/maintainers/allanivp)

---

Top Contributors

[![allanmcarvalho](https://avatars.githubusercontent.com/u/12012197?v=4)](https://github.com/allanmcarvalho "allanmcarvalho (58 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")

---

Tags

laravelnumerableallanmcarvalho

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/allanmcarvalho-numerable/health.svg)

```
[![Health](https://phpackages.com/badges/allanmcarvalho-numerable/health.svg)](https://phpackages.com/packages/allanmcarvalho-numerable)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
