PHPackages                             scybulski/laravel-validator-color - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. scybulski/laravel-validator-color

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

scybulski/laravel-validator-color
=================================

Validate that a certain value is a valid CSS color string in Laravel

4.4.2(2y ago)02.2kMITPHPPHP &gt;=7.4 &lt;8.4

Since May 11Pushed 2y agoCompare

[ Source](https://github.com/scybulski/laravel-validator-color)[ Packagist](https://packagist.org/packages/scybulski/laravel-validator-color)[ Docs](https://github.com/scybulski/laravel-validator-color)[ RSS](/packages/scybulski-laravel-validator-color/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (14)Used By (0)

Validate colors with Laravel 5+
===============================

[](#validate-colors-with-laravel-5)

[![Latest Version](https://camo.githubusercontent.com/87c986e1b164a1c23d3165007b591e58116eb52d765628fef7d2958df493e0ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73637962756c736b692f6c61726176656c2d76616c696461746f722d636f6c6f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/scybulski/laravel-validator-color/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/efc6df8facddf6124be10a3928b5123bc917dead67dadc0b34c9fa5ce32402ca/68747470733a2f2f7472617669732d63692e6f72672f73637962756c736b692f6c61726176656c2d76616c696461746f722d636f6c6f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/scybulski/laravel-validator-color)[![Total Downloads](https://camo.githubusercontent.com/af49adde5608c8c26281ed17deaa17787cdf3ed5e5ed4a4b9694a660be28be57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73637962756c736b692f6c61726176656c2d76616c696461746f722d636f6c6f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/scybulski/laravel-validator-color)

This package will let you validate that a certain value is a valid CSS color string.

Installation
------------

[](#installation)

Install via [composer](https://getcomposer.org/) - In the terminal:

```
composer require scybulski/laravel-validator-color
```

Usage
-----

[](#usage)

You can use this package either by passing strings to Validator or using Rule Objects.

### Validator strings

[](#validator-strings)

You need to register a service provider by adding the following to the `providers` array in your `config/app.php`

```
scybulski\Validator\Color\ServiceProvider::class
```

Then you can use the rules in a Controller or Form Request as following.

```
use Illuminate\Foundation\Http\FormRequest;

class MyClass extends FormRequest
{
    public function rules()
    {
        return [
            'color'           => 'required|other_rule|color',
            'color_hex'       => 'required|other_rule|color_hex',
            'color_keyword'   => 'required|other_rule|color_keyword',
            'color_long_hex'  => 'required|other_rule|color_long_hex',
            'color_rgb'       => 'required|other_rule|color_rgb',
            'color_rgba'      => 'required|other_rule|color_rgba',
            'color_rgb_any'   => 'required|other_rule|color_rgb_any',
            'color_short_hex' => 'required|other_rule|color_short_hex',
        ];
    }
}
```

### Rule Objects

[](#rule-objects)

You can define validation rules in a Controller or Form Request as following.

```
use Illuminate\Foundation\Http\FormRequest;
use scybulski\Validator\Color\Rules\Color;
use scybulski\Validator\Color\Rules\ColorHex;
use scybulski\Validator\Color\Rules\ColorKeyword;
use scybulski\Validator\Color\Rules\ColorLongHex;
use scybulski\Validator\Color\Rules\ColorRgb;
use scybulski\Validator\Color\Rules\ColorRgba;
use scybulski\Validator\Color\Rules\ColorRgbAny;
use scybulski\Validator\Color\Rules\ColorShortHex;

class MyClass extends FormRequest
{
    public function rules()
    {
        return [
            'color'           => ['required', 'other_rule', new Color],
            'color_hex'       => ['required', 'other_rule', new ColorHex],
            'color_keyword'   => ['required', 'other_rule', new ColorKeyword],
            'color_long_hex'  => ['required', 'other_rule', new ColorLongHex],
            'color_rgb'       => ['required', 'other_rule', new ColorRgb],
            'color_rgba'      => ['required', 'other_rule', new ColorRgba],
            'color_rgb_any'   => ['required', 'other_rule', new ColorRgbAny],
            'color_short_hex' => ['required', 'other_rule', new ColorShortHex],
        ];
    }
}
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 52.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~251 days

Total

12

Last Release

891d ago

Major Versions

1.0.0 → 2.0.02017-04-19

2.0.0 → 3.0.02017-04-20

3.0.2 → 4.0.02020-02-25

PHP version history (6 changes)1.0.0PHP ^5.5.9|^7.0

4.0.0PHP &gt;=7.0 &lt;7.5

4.2.0PHP &gt;=7.0 &lt;8.1

4.3.0PHP &gt;=7.4 &lt;8.2

4.4.0PHP &gt;=7.4 &lt;8.3

4.4.2PHP &gt;=7.4 &lt;8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/05bd7953d7d65efc009a68dd6b277d0a5c6b1dee95f0dafbc5984101f727ee46?d=identicon)[scybulski](/maintainers/scybulski)

---

Top Contributors

[![tylercd100](https://avatars.githubusercontent.com/u/4522226?v=4)](https://github.com/tylercd100 "tylercd100 (12 commits)")[![scybulski](https://avatars.githubusercontent.com/u/10341108?v=4)](https://github.com/scybulski "scybulski (10 commits)")[![claretnnamocha](https://avatars.githubusercontent.com/u/43606892?v=4)](https://github.com/claretnnamocha "claretnnamocha (1 commits)")

---

Tags

laravelvalidatorcolortylercd100scybulski

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scybulski-laravel-validator-color/health.svg)

```
[![Health](https://phpackages.com/badges/scybulski-laravel-validator-color/health.svg)](https://phpackages.com/packages/scybulski-laravel-validator-color)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[sunspikes/clamav-validator

Custom Laravel 5 anti-virus validator for file uploads.

3651.8M3](/packages/sunspikes-clamav-validator)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)[tylercd100/laravel-validator-color

Validate that a certain value is a valid CSS color string in Laravel 5

1580.1k](/packages/tylercd100-laravel-validator-color)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
