A class for casting ramsey/uuid into laravel models
floor9design/laravel-casts-uuid is a Laravel package for a class for casting ramsey/uuid into laravel models.
It currently has 0 GitHub stars and 5.057 downloads on Packagist (latest version 1.1.1).
Install it with composer require floor9design/laravel-casts-uuid.
Discover more Laravel packages by floor9design
or browse all Laravel packages to compare alternatives.
Last updated
The Laravel Framework supports casting of types within models. This class adds the ramsey/uuid UUID class support
for laravel models.
Add the following to the composer.json:
"require": {
"floor9design/laravel-casts-uuid": "^1.0",
}
There are no specific config setup steps required. The class should autoload in PSR-4 compliant systems. If you are using the class on its own, simply include it when using a model:
use Floor9design\LaravelCasts\Uuid as UuidCasts;
protected $casts = [
'uuid' => UuidCasts::class
];
Note the alias - often it is useful to alias the casting class as it can clash with other Uuid classes, such as the base Uuid class:
use Ramsey\Uuid\Uuid;
// somewhere in the code:
$uuid = Uuid::uuid4();
Tests can be run as follows:
./vendor/phpunit/phpunit/phpunitStatic analysis/code review can be performed by using phpstan:
./vendor/bin/phpstanThe following tests and also creates code coverage (usually maintained at 100%)
./vendor/phpunit/phpunit/phpunit --coverage-html docs/tests/A changelog is generated here:
This software is proprietary.