larsmbergvall / utilities-for-laravel
Some utilities and helpers for use in Laravel projects
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/larsmbergvall/utilities-for-laravel
Requires
- php: >=8.3
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.25
- phpstan/phpstan: ^2.1
This package is not auto-updated.
Last update: 2026-01-08 16:06:41 UTC
README
This is a collection of some utilities that I personally use when developing Laravel applications. Feel free to use them in your own projects!
Usage
You can publish the action stub with:
php artisan vendor:publish --tag=utilities-for-laravel-stubs
You can publish the config with:
php artisan vendor:publish --tag=utilities-for-laravel-config
What is included?
Make:action command
php artisan make:action CreatePost command that creates an action class
* This would create a CreatePostAction.cs - if you don't want the suffix you can disable it in the config file (or
change the suffix to something else)
Result class
A Result class inspired by Rusts Result type
/** @var Result<array, string> $result */ // $result = Result::ok(['value' => 'foo']); $result = Result::err('something went wrong'); $result->match( ok: fn(array $data) => dd($data), err: fn(string $error) => dd($error) ); // $data = $result->getValue(); $error = $result->getErr();