Data URI Rule

Validate Data URI scheme string

120k Downloads / Month

Open Source MIT License

public Intervention\Validation\Rules\DataUri::__construct(?array $media_types = null)

The field under validation must be a valid Data URI.

Parameters

media_types (optional)

Parameter to determine the media type to be validated. Can either be null to allow all valid media types or an array of allowed types.

Example

use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\DataUri;

$validator = Validator::make($request->all(), [
    'attribute-key' => new DataUri(),
]);
use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\DataUri;

$validator = Validator::make($request->all(), [
    'attribute-key' => new DataUri([
        'image/jpeg',
        'image/png',
    ]),
]);
Edit