Data URI Rule

Validate Data URI scheme string

95k 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 Intervention\Validation\Rules\DataUri;

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

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