PHPackages                             oltrematica/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. oltrematica/laravel-toolkit

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

oltrematica/laravel-toolkit
===========================

Laravel Toolkit is a collection of reusable utilities, helpers, and value objects for Laravel projects, designed to standardize and simplify development at Oltrematica

v0.1.2(1y ago)01.1k[5 PRs](https://github.com/Oltrematica/laravel-toolkit/pulls)1MITPHPPHP ^8.3CI passing

Since May 16Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Oltrematica/laravel-toolkit)[ Packagist](https://packagist.org/packages/oltrematica/laravel-toolkit)[ RSS](/packages/oltrematica-laravel-toolkit/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (13)Versions (10)Used By (1)

[![GitHub Tests Action Status](https://github.com/Oltrematica/laravel-toolkit/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Oltrematica/laravel-toolkit/actions/workflows/run-tests.yml/badge.svg)[![GitHub PhpStan Action Status](https://github.com/Oltrematica/laravel-toolkit/actions/workflows/phpstan.yml/badge.svg)](https://github.com/Oltrematica/laravel-toolkit/actions/workflows/phpstan.yml/badge.svg)[![Latest Version on Packagist](https://camo.githubusercontent.com/75a36925ee6727540d435864099f7eebe1a031b10beda3de0dcce239122889ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6c7472656d61746963612f6c61726176656c2d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oltrematica/laravel-toolkit)[![Total Downloads](https://camo.githubusercontent.com/0e6bc85a602da7949687790573f1432afb57b349703c217f9746afd281dee2f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6c7472656d61746963612f6c61726176656c2d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oltrematica/laravel-toolkit)

Laravel Toolkit
===============

[](#laravel-toolkit)

Laravel Toolkit is a curated set of reusable components aimed at improving productivity and consistency across Oltrematica’s Laravel projects.

This package provides utilities, helpers, macros, traits, and value objects commonly used in our codebase, offering ready-made solutions for frequent challenges and promoting shared best practices. Laravel Toolkit was created to centralize cross-cutting or repetitive code, reducing duplication and making maintenance easier.

Features include standardized operation result handling (Result pattern), string, array, and date helpers, Eloquent and Collection macros, reusable traits, and other tools for everyday development.

The package is designed to be lightweight, modular, and easily extensible, adapting to the evolving needs of Oltrematica’s teams.

Prerequisites
-------------

[](#prerequisites)

- Laravel v10, v11 and v12
- PHP 8.3 or higher

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

[](#installation)

```
composer require oltrematica/laravel-toolkit
```

Usage Guide
===========

[](#usage-guide)

Result
------

[](#result)

The Result class is a simple, immutable value object designed to represent the outcome of an operation in a consistent way. It allows you to standardize how you return success, error, or failure (with exception) from your services, actions, or domain logic.

Use Result to make your service and action return values explicit and consistent, improving error handling and readability throughout your codebase.

### Creating a Success Result

[](#creating-a-success-result)

```
use Oltrematica\Toolkit\Support\Result;

$result = Result::success('Operation completed successfully', ['foo' => 'bar']);

// Check if successful
if ($result->isSuccess()) {
    $data = $result->getData();
    // Handle success
}
```

### Creating an Error Result

[](#creating-an-error-result)

```
$result = Result::error('Validation failed', ['field' => 'email']);

// Check if error
if ($result->isError()) {
    $message = $result->getMessage();
    $data = $result->getData();
    // Handle error
}
```

### Creating a Failure Result (with Exception)

[](#creating-a-failure-result-with-exception)

```
try {
    // Some operation that may throw
} catch (Throwable $e) {
    $result = Result::failure($e, 'Unexpected exception occurred');
}

// Check if failure (error with exception)
if ($result->isFailure()) {
    $exception = $result->getThrowable();
    // Handle failure, log exception, etc.
}
```

### Result API Reference

[](#result-api-reference)

MethodDescriptionResult::success()Create a success result (optionally with message/data)Result::error()Create an error result (optionally with message/data/exception)Result::failure()Create an error result with an exceptionisSuccess()Returns true if result is successfulisError()Returns true if result is an error (including failures)isFailure()Returns true if result is an error with exceptiongetMessage()Returns the result messagegetData()Returns the attached datagetThrowable()Returns the exception, if anyResponseStatus Enum
-------------------

[](#responsestatus-enum)

The `ResponseStatus` enum defines a standard set of response statuses to represent the outcome of operations.

```
use Oltrematica\Toolkit\Enums\ResponseStatus;

$status = ResponseStatus::SUCCESS;

if ($status->isSuccess()) {
    // Handle success
} elseif ($status->isError()) {
    // Handle error
} elseif ($status->isFailure()) {
    // Handle failure
}
```

Code Quality
------------

[](#code-quality)

The project includes automated tests and tools for code quality control.

### Rector

[](#rector)

Rector is a tool for automating code refactoring and migrations. It can be run using the following command:

```
composer refactor
```

### PhpStan

[](#phpstan)

PhpStan is a tool for static analysis of PHP code. It can be run using the following command:

```
composer analyse
```

### Pint

[](#pint)

Pint is a tool for formatting PHP code. It can be run using the following command:

```
composer format
```

### Automated Tests

[](#automated-tests)

The project includes automated tests and tools for code quality control.

```
composer test
```

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

[](#contributing)

Feel free to contribute to this package by submitting issues or pull requests. We welcome any improvements or bug fixes you may have.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance68

Regular maintenance activity

Popularity16

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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 ~2 days

Total

3

Last Release

409d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/143425497?v=4)[Oltrematica Srl](/maintainers/oltrematica)[@Oltrematica](https://github.com/Oltrematica)

---

Top Contributors

[![mirchaemanuel](https://avatars.githubusercontent.com/u/1971953?v=4)](https://github.com/mirchaemanuel "mirchaemanuel (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelutilitiestoolkitoltrematica

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

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