for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Milwad\LaravelValidate\Rules;
use Illuminate\Contracts\Validation\Rule;
class ValidUrl implements Rule
{
/**
* Check url is valid.
*/
public function passes($attribute, $value): bool
return preg_match('/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/', $value);
return preg_match('/http...~#?&\/\/=]*)/', $value)
integer
boolean
}
* Get the validation error message.
public function message(): string
return __('validate.url');