PHP code example of sourcetoad / rule-helper-for-laravel

1. Go to this page and download the library: Download sourcetoad/rule-helper-for-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sourcetoad / rule-helper-for-laravel example snippets


use App\Rules\CustomRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Unique;
use Sourcetoad\RuleHelper\RuleSet;

class CreateBlogRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'title' => RuleSet::create()
                ->

use Illuminate\Foundation\Http\FormRequest;
use Sourcetoad\RuleHelper\Rule;

class CreateBlogRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'title' => [
                Rule::

    public function boot(): void
    {
        RuleSet::define('existing_email', RuleSet::create()->email()->exists('users'));
    }

    public function rules(): array
    {
        return [
            'to' => RuleSet::useDefined('existing_email')->

RuleSet::create()->