Download the PHP package michael-rubel/laravel-value-objects without Composer
On this page you can find all versions of the php package michael-rubel/laravel-value-objects. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download michael-rubel/laravel-value-objects
More information about michael-rubel/laravel-value-objects
Files in michael-rubel/laravel-value-objects
Package laravel-value-objects
Short Description It is an example template for Laravel packages. Fill or change it the way you like.
License MIT
Homepage https://github.com/michael-rubel/laravel-value-objects
Informations about the package laravel-value-objects
Laravel Value Objects
A bunch of general-purpose value objects you can use in your Laravel application.
The package requires PHP 8.1
or higher and Laravel 10
or higher.
StandWithUkraine
Installation
Install the package using composer:
Built-in value objects
Artisan command
You can generate custom value objects with Artisan command:
Usage
Boolean
Number
Text
ClassString
FullName
Name
Phone
TaxNumber
Url
Uuid
Handle failed validation
If you want to avoid try/catching your value object when the validation fails, you can use makeOrNull
method:
Extending functionality
All value objects are Macroable.
This way you can add new methods dynamically. If you need to extend existing methods, you can create a value object locally with make:value-object
command and use inheritance.
For example:
Conditionable
Value objects utilize a Conditionable trait.
You can use when
and unless
methods.
Contributing
If you see any way we can improve the package, or maybe you want to make your own custom value object as built-in, PRs are welcome.
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-value-objects with dependencies
illuminate/contracts Version ^10.0|^11.0
illuminate/validation Version ^10.0|^11.0
michael-rubel/laravel-formatters Version ^8.0
phpmath/bignumber Version ^1.2
spatie/laravel-package-tools Version ^1.12