Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Uuid Rule Laravel Package

rap2hpoutre/uuid-rule

A Laravel validation rule for UUID strings. Use it in form requests or validators to confirm that input is a valid UUID, keeping UUID checks reusable and avoiding ad hoc regex validation.

View on GitHub
Deep Wiki
Context7

UUID validation rule for Laravel

Frequently asked questions about Uuid Rule
How do I install the UUID validation rule package in Laravel?
Install it with Composer by running composer require rap2hpoutre/uuid-rule from the root of your Laravel project. Composer adds the package to composer.json and your lock file, and Laravel's autoloading makes the rule available to your code. Commit both files so other environments install the same version.
How do I use this UUID rule in a Laravel form request?
Add the package's UUID rule to the rules() array for the field you want to validate, usually alongside required. Then type-hint the form request in your controller method so Laravel runs validation automatically before your handler executes. Invalid UUID strings will then produce standard validation errors you can display in your views or API responses.
Can I use the UUID rule with Validator::make or the validate() helper?
Yes. Laravel validation rules work at the framework level, so the UUID rule can be used with Validator::make, the validate() helper on an incoming request, and FormRequest classes alike. Combine it with required or nullable depending on whether the field is mandatory.
How is this package different from Laravel's built-in uuid validation rule?
Modern Laravel versions already ship a built-in uuid rule, so this package is mainly useful as a dedicated, reusable rule object or for setups where you prefer the check to live in a separate Composer dependency. If you are on a current Laravel release, compare the built-in rule's behavior with this package before adding the dependency.
Which UUID versions does the rule accept?
The rule is focused on confirming that a string is a valid UUID rather than generating or interpreting UUIDs. If your application depends on one specific variant, such as v4 only, check the package README for the accepted formats and cover your expected values with tests. That way any change in behavior shows up immediately.
Which Laravel versions does rap2hpoutre/uuid-rule support?
Support depends on the illuminate/support constraint declared in the package's composer.json. Check that constraint on Packagist or in the repository before installing, especially if you are on an older or very recent Laravel release. After a framework upgrade, run your test suite to confirm the rule still behaves as expected.
Do I need to register a service provider or config file after installation?
Usually no. Like most small Laravel packages it is loaded through Composer autoloading, and package discovery handles any provider registration automatically. If the README mentions a provider or alias, follow those instructions, and clear your config cache after installing.
How do I test UUID validation in my Laravel test suite?
Build a request or validator using the UUID rule and assert that valid UUID strings pass while malformed ones fail, using PHPUnit or Pest. Include at least one known-good UUID and one near-miss string such as a truncated or non-hex value. This catches regressions when you upgrade Laravel or the package.
Can I combine the UUID rule with nullable or sometimes rules?
Yes, validation rules compose normally. Add nullable when the field may be null or omitted, sometimes when the field might not be present in the payload at all, and required when it must be supplied. The UUID rule only runs against whatever value reaches it.
Is the package actively maintained, and what are the alternatives?
Check recent commits, Packagist release history, and open issues on the repository to judge maintenance before adopting it. Alternatives include Laravel's built-in uuid rule and a small custom regex or closure rule. Weigh the extra dependency against the reuse a dedicated rule class gives you across form requests and validators.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin