承接 kaishiyoku/laravel-color-validation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kaishiyoku/laravel-color-validation

最新稳定版本:3.2.0

Composer 安装命令:

composer require kaishiyoku/laravel-color-validation

包简介

Laravel color validation rules

README 文档

README

Tests Latest Stable Version Total Downloads License PHP Version Require

About

This package will let you validate that a certain value is a valid CSS color string using Laravel >= 10.

Minimum requirements

  • PHP 8.1
  • Laravel 10

Installation

Install via composer - In the terminal:

composer require kaishiyoku/laravel-color-validation

If you're not using package auto-discovery add the following to the providers array in your config/app.php

Kaishiyoku\Validation\Color\ServiceProvider::class,

Usage

// Test any color type
Validator::make(['test' => '#454ACF'], ['test' => 'color']);

// Test for rgb 
Validator::make(['test' => 'rgb(0, 200, 150)'], ['test' => 'color_rgb']);

// Test for rgba 
Validator::make(['test' => 'rgba(0, 200, 150, 0.52)'], ['test' => 'color_rgba']);

// Test for hex 
Validator::make(['test' => '#333'], ['test' => 'color_hex']);

// Test for color name
Validator::make(['test' => 'DeepSkyBlue'], ['test' => 'color_name']);
Validator::make(['test' => 'transparent'], ['test' => 'color_name']);

Using other locales

By default English, German and French locales can be used. If you're using a different locale you will have to add a validation.php file and a custom folder named after the locale code (e.g. ja for Japanese) to the /resources/lang/vendor/color_validation/ folder.

Example folder structure:

.
    └── resources
        └── lang
            └── vendor
                └── color_validation
                    ├── de
                    ├── en
                    └── ja

Adjusting existing locales

If you want to change any of the existing translations, you can publish the locale files with:

php artisan vendor:publish --provider="Kaishiyoku\Validation\Color\ServiceProvider"

License

MIT (https://github.com/Kaishiyoku/laravel-color-validation/blob/master/LICENSE)

Author

Website: andreas-wiedel.de

统计信息

  • 总下载量: 190.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-13