Skip to content

vlauciani/laravel-validation-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-validation-rules

Tests Packagist License Total Downloads

Installation

composer require vlauciani/laravel-validation-rules:^1.0.0

Available Rules

RFC3339Extended

PHP doesn't validate correctly RFC3339: laravel/framework#35387

  • for example 2020-12-21T23:59:59+00:00 or 2020-12-21T23:59:59Z return false but it is true.

this Rule uniform the date in format: YYYY-MM-DDThh:mm:ss.mmm+nn:nn

Usage

<?php
namespace App\Api\Controllers;
use App\Http\Controllers\Controller;
use VLauciani\LaravelValidationRules\Rules\RFC3339ExtendedRule;

class MyController extends Controller
{
    public function index()
    {
        $myData = ['starttime' => '2022-04-06T12:00:00.123+00:00']
        Validator::make($myData, [
            'starttime'           => [new RFC3339ExtendedRule()],
        ])->validate();
    }
}

Contribute

Thanks to your contributions!

Here is a list of users who already contributed to this repository:

Author

(c) 2022 Valentino Lauciani vlauciani[at]gmail.com

Thanks to