PHPackages                             gabrielesbaiz/laravel-toolkit - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gabrielesbaiz/laravel-toolkit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gabrielesbaiz/laravel-toolkit
=============================

A Laravel toolkit package for common utility helpers.

v1.12.0(2mo ago)02.5k↑950%MITPHPPHP ^8.0CI passing

Since Feb 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/gabrielesbaiz/laravel-toolkit)[ Packagist](https://packagist.org/packages/gabrielesbaiz/laravel-toolkit)[ Docs](https://github.com/gabrielesbaiz/laravel-toolkit)[ GitHub Sponsors]()[ RSS](/packages/gabrielesbaiz-laravel-toolkit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (28)Versions (21)Used By (0)

LaravelToolkit
==============

[](#laraveltoolkit)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ea057359200ea91d25988059901b2cc8a3dc7dc0d26d70919f7919735594801a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c65736261697a2f6c61726176656c2d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/laravel-toolkit)[![Total Downloads](https://camo.githubusercontent.com/abc89786bdac8cb2bf2c2c5c0711e6414137da19ae7fda8a75841de122b4f813/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c65736261697a2f6c61726176656c2d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/laravel-toolkit)

A **lightweight and powerful helper package** for Laravel that provides utilities for **strings**, **numbers**, **time**, **web**, and **phone number** operations.

Features
--------

[](#features)

- ✅ String utilities (*StringKit*)
- ✅ Number utilities (*NumberKit*)
- ✅ Time utilities (*TimeKit*)
- ✅ Web utilities (*WebKit*)
- ✅ Phone number utilities (*PhoneKit*)
- ✅ Works seamlessly with Laravel facades

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

[](#installation)

You can install the package via composer:

```
composer require gabrielesbaiz/laravel-toolkit
```

Laravel will automatically register the service provider and facades.

If necessary, you can manually add the service provider in `config/app.php`:

```
'providers' => [
    Gabrielesbaiz\LaravelToolkit\LaravelToolkitServiceProvider::class,
],
```

And the facades:

```
'aliases' => [
    'LaravelToolkit' => Gabrielesbaiz\LaravelToolkit\Facades\LaravelToolkit::class,
    'StringKit' => Gabrielesbaiz\LaravelToolkit\Facades\StringKit::class,
    'NumberKit' => Gabrielesbaiz\LaravelToolkit\Facades\NumberKit::class,
    'TimeKit' => Gabrielesbaiz\LaravelToolkit\Facades\TimeKit::class,
    'WebKit' => Gabrielesbaiz\LaravelToolkit\Facades\WebKit::class,
    'PhoneKit' => Gabrielesbaiz\LaravelToolkit\Facades\PhoneKit::class,
],
```

Usage
-----

[](#usage)

```
$laravelToolkit = new Gabrielesbaiz\LaravelToolkit();

echo $laravelToolkit->string()->startsWithLetter('Hello'); // true
echo $laravelToolkit->number()->toDecimalPoint('1.234,56'); // 1234.56
echo $laravelToolkit->time()->nowYear(); // 2025
echo $laravelToolkit->web()->isValidUrl('https://example.com'); // true
echo $laravelToolkit->phoneNumber()->removePhoneCode('+391234567890'); // 1234567890
```

Using facade:

```
use LaravelToolkit;

LaravelToolkit::string()->startsWithLetter('Hello'); // true
LaravelToolkit::number()->toDecimalPoint('1.234,56'); // 1234.56
LaravelToolkit::time()->nowYear(); // 2025
LaravelToolkit::web()->isValidUrl('https://example.com'); // true
LaravelToolkit::phoneNumber()->removePhoneCode('+391234567890'); // 1234567890
```

Using dedicated facades:

### StringKit

[](#stringkit)

```
use StringKit;

StringKit::startsWithLetter("hello"); // true
StringKit::upperCase("hello"); // "HELLO"
StringKit::trimSpaces("  hello  "); // "hello"
```

### NumberKit

[](#numberkit)

```
use NumberKit;

NumberKit::numberIsBetween(10, 5, 15); // true
NumberKit::toThousandsDecimal(123456.789); // "123.456,79"
```

### TimeKit

[](#timekit)

```
use TimeKit;

TimeKit::nowYear(); // 2025
TimeKit::dateComplete(now()); // "10/03/2025 14:30:00"
```

### WebKit

[](#webkit)

```
use WebKit;

WebKit::isValidUrl("https://example.com"); // true
```

### PhoneKit

[](#phonekit)

```
use PhoneKit;

PhoneKit::normalizePhoneNumber("+39 123 456 7890"); // "1234567890"
```

Available Methods
-----------------

[](#available-methods)

### **StringKit**

[](#stringkit-1)

- `StringKit::clearNewLines(?string $string): ?string` - Removes newline characters.
- `StringKit::clearNonNumeric(?string $string): ?string` - Removes all non-numeric characters from a string.
- `StringKit::clearSpaces(?string $string): ?string` - Replaces multiple spaces with a single space.
- `StringKit::clearTabs(?string $string): ?string` - Removes tab characters.
- `StringKit::convertToFemale(?string $string): ?string` - Converts male name endings ('o') to female ('a').
- `StringKit::isFemale(?string $string): bool` - Determines if a name is female based on the last letter.
- `StringKit::normalizeNames(?string $string): ?string` - Normalizes names to title case, handling apostrophes.
- `StringKit::nullIfEmpty($string): ?string` - Returns null if the string is empty.
- `StringKit::snakeSpaces(?string $string): ?string` - Replaces spaces with underscores.
- `StringKit::startsWithLetter($string): bool` - Checks if a string starts with a letter.
- `StringKit::startsWithNumber($string): bool` - Checks if a string starts with a number.
- `StringKit::trimSpaces(?string $string): ?string` - Trims spaces from both sides of a string.
- `StringKit::upperCase(?string $string): ?string` - Converts the string to uppercase.
- `StringKit::zapSpaces(?string $string): ?string` - Removes all spaces and special characters.

### **NumberKit**

[](#numberkit-1)

- `NumberKit::hasPositiveSum(array $values): bool` - Checks if the sum of values is positive.
- `NumberKit::numberIsBetween(float $number, float $min, float $max): bool` - Checks if a number is within a range.
- `NumberKit::roundDownToMultiple(float $number, ?int $multiple): float` - Rounds a number down to the nearest multiple.
- `NumberKit::rounded(mixed $value): float` - Rounds a number to two decimals.
- `NumberKit::rounded3(mixed $value): float` - Rounds a number to three decimals.
- `NumberKit::rounded4(mixed $value): float` - Rounds a number to four decimals.
- `NumberKit::roundUpToMultiple(float $number, ?int $multiple): float` - Rounds a number up to the nearest multiple.
- `NumberKit::toCommaString(float $value): string` - Converts a float value to a string with a comma as decimal separator and two fixed decimal places.
- `NumberKit::toCurrency(?string $value): float` - Converts a number to a rounded currency format.
- `NumberKit::toCurrencyIntString(?string $value): ?string` - Formats an integer as a currency string.
- `NumberKit::toCurrencyIntStringHtml(?string $value): ?string` - Formats an integer as a currency string with an HTML Euro sign.
- `NumberKit::toCurrencyString(?string $value): ?string` - Formats a number as a currency string.
- `NumberKit::toCurrencyStringHtml(?string $value): ?string` - Formats a number as a currency string with an HTML Euro sign.
- `NumberKit::toCurrencyStringWithSign(?string $value): ?string` - Formats a number as a currency string with a sign.
- `NumberKit::toDecimalComma(?string $value): string` - Converts a decimal point to a comma format.
- `NumberKit::toDecimalCommaString(?string $value): string` - Converts a decimal point to a comma formatand '—' for 0 values.
- `NumberKit::toDecimalPoint(?string $value): float` - Converts a formatted number to a decimal point.
- `NumberKit::toFloor(mixed $value): float` - Floors a number to two decimal places.
- `NumberKit::toInt(mixed $value, int $precision): int` - Converts a float to an integer with precision.
- `NumberKit::toIntString(?string $value): ?string` - Converts an integer value to a string, returning '—' if zero or null.
- `NumberKit::toPercentageIntString(?string $value): ?string` - Formats an integer as a percentage string.
- `NumberKit::toPercentageRoundString(?string $value): ?string` - Formats a rounded number as a percentage string.
- `NumberKit::toPercentageString(?string $value, ?int $decimals = null): ?string` - Formats a number as a percentage.
- `NumberKit::toPriceInt(mixed $value): int` - Converts a float to its integer price value (in cents).
- `NumberKit::toThousands(?string $value): string` - Formats a number with thousand separators.
- `NumberKit::toThousandsDecimal(?string $value): string` - Formats a number with thousands and two decimal places.
- `NumberKit::toThousandsString(?string $value): string` - Formats a number with thousand separators and '—' for 0 values.

### **TimeKit**

[](#timekit-1)

- `TimeKit::timeDiff(Carbon $dateTo, Carbon $dateFrom, ?int $parts = 4): string` - Returns the time difference between two dates.
- `TimeKit::convertDateToDmy(?string $value): ?string` - Converts Y-m-d to d/m/Y.
- `TimeKit::convertDateToDmyhis(?string $value): ?string` - Converts Y-m-d to d/m/Y H:i:s.
- `TimeKit::convertDmyhisToDate(?string $value): ?string` - Converts d/m/Y H:i:s to Y-m-d.
- `TimeKit::convertDmyMinusToDate(?string $value): ?string` - Converts d-m-Y to Y-m-d.
- `TimeKit::convertDmyToDate(?string $value): ?string` - Converts d/m/Y to Y-m-d.
- `TimeKit::convertDmyToTimestamp(?string $value): ?string` - Converts d/m/Y to Y-m-d H:i:s.
- `TimeKit::convertIso8601ToDmyHi(?string $value): ?string` - Converts an ISO8601 date to d/m/Y H:i.
- `TimeKit::convertTimestampToDmy(?string $value): ?string` - Converts Y-m-d H:i:s to d/m/Y.
- `TimeKit::convertTimestampToDmyHi(?string $value): ?string` - Converts Y-m-d H:i:s to d/m/Y H:i.
- `TimeKit::countDaysBetween(Carbon $startDate, Carbon $endDate): int` - Counts the days between two dates.
- `TimeKit::countDiffDays(string $date): int` - Counts the days between now and a given date.
- `TimeKit::countDiffMonths(Carbon $endDate): int` - Counts the month difference between now and a given date.
- `TimeKit::dateBase(?Carbon $date): ?string` - Returns a base date in d/m/Y format.
- `TimeKit::dateComplete(?Carbon $date): ?string` - Returns a complete date in d/m/Y H:i:s format.
- `TimeKit::dateCompleteWithDay(?Carbon $date): ?string` - Returns a full date including the weekday.
- `TimeKit::diffHumans(?Carbon $value): ?string` - Returns a human-readable difference from now.
- `TimeKit::diffHumansComplete(?Carbon $value): ?string` - Returns a detailed human-readable difference.
- `TimeKit::diffHumansLong(?Carbon $value): ?string` - Returns a longer human-readable difference.
- `TimeKit::diffHumansShort(?Carbon $value): ?string` - Returns a shorter human-readable difference.
- `TimeKit::excelToCarbon(int $excelDate): Carbon` - Converts an Excel date to a Carbon date.
- `TimeKit::futureMonthNameLowercase(): string` - Retrieves the name of the month two months ahead.
- `TimeKit::googleDate(Carbon $date): int` - Converts a Carbon date to a Google date integer.
- `TimeKit::monthName(int $monthNumber): ?string` - Retrieves a month name by number.
- `TimeKit::monthNameLowercase(int $monthNumber): ?string` - Retrieves a lowercase month name by number.
- `TimeKit::months(): array` - Retrieves an array of month names.
- `TimeKit::monthsAbbreviations(): array` - Retrieves an array of abbreviated month names.
- `TimeKit::nextMonthNameLowercase(): string` - Retrieves the name of the next month.
- `TimeKit::nowFormat(): string` - Returns the current date and time in d/m/Y H:i:s format.
- `TimeKit::nowYear(): int` - Returns the current year.
- `TimeKit::pastMonthNameLowercase(): string` - Retrieves the name of the month two months ago.
- `TimeKit::previousMonthNameLowercase(): string` - Retrieves the name of the previous month.
- `TimeKit::thisMonthNameLowercase(): string` - Retrieves the name of the current month.
- `TimeKit::todayFormat(): string` - Returns today's date in d/m/Y format.

### **WebKit**

[](#webkit-1)

- `WebKit::isValidUrl(string $string): bool` - Checks if a string is a valid URL.
- `WebKit::removeMailTo(?string $string): ?string` - Removes 'mailto:' from an email string.

### **PhoneKit**

[](#phonekit-1)

- `PhoneKit::normalizePhoneNumber(?string $string): ?string` - Normalizes a phone number by removing the country code and spaces.
- `PhoneKit::phoneNumberHide(?string $number): ?string` - Masks all but the last three digits of a phone number.
- `PhoneKit::removePhoneCode(?string $string): ?string` - Removes the international dialing code from a phone number.

Testing
-------

[](#testing)

Run tests using Pest:

```
vendor/bin/pest
```

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)

- [Gabriele Sbaiz](https://github.com/gabrielesbaiz)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~22 days

Recently: every ~82 days

Total

18

Last Release

68d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97040fb60637d4b81897347524bc9343ffa6b978d4b19c0c28ea0823e2a1752b?d=identicon)[gabrielesbaiz](/maintainers/gabrielesbaiz)

---

Top Contributors

[![gabrielesbaiz](https://avatars.githubusercontent.com/u/22818698?v=4)](https://github.com/gabrielesbaiz "gabrielesbaiz (23 commits)")

---

Tags

laravel-packagephplaravelGabriele Sbaizlaravel-toolkit

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gabrielesbaiz-laravel-toolkit/health.svg)

```
[![Health](https://phpackages.com/badges/gabrielesbaiz-laravel-toolkit/health.svg)](https://phpackages.com/packages/gabrielesbaiz-laravel-toolkit)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[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)

PHPackages © 2026

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