PHP code example of seffeng / laravel-rules

1. Go to this page and download the library: Download seffeng/laravel-rules 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/ */

    

seffeng / laravel-rules example snippets


/**
 * TestRequest.php
 * 表单验证示例
 */
namespace App\Http\Requests;

use Seffeng\LaravelRules\Rules\Password;
use Seffeng\LaravelRules\Rules\Phone;

class TestRequest
{
    protected $fillable = ['phone', 'password'];

    public function rules()
    {
        return [
            'phone' => [
                '
    {
        return [
            'phone' => '手机号',
            'password' => '密码',
        ];
    }
}

├─src
│  └─Rules                  验证规则
│       Password.php            密码
│       Phone.php               手机号