Skip to content

Commit

Permalink
Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
russoedu committed Sep 10, 2015
1 parent 3cee3e3 commit 13194c4
Show file tree
Hide file tree
Showing 7 changed files with 397 additions and 80 deletions.
5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

371 changes: 371 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All Notable changes to color-validator will be documented in this file
All Notable changes to colorvalidator will be documented in this file

### Added
- Nothing
Expand Down
22 changes: 0 additions & 22 deletions LICENSE

This file was deleted.

57 changes: 19 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,40 @@
# HEXADECIMAL COLOR VALIDATOR
# Hexadecimal Color Validator Rules for Laravel 5

Validator for hexadecimal colors for Laravel 5.

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]

Validator for hexadecimal colors for Laravel 5.

## Install
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)

Via Composer
<a name="installation"></a>
## Installation

``` bash
$ composer require russoedu/color-validator
```
Install the package through [Composer](http://getcomposer.org).

**Together with Laravel**
```
composer require "russoedu/colorvalidator:1.0"
```

As standard Laravel-procedure, just register the package in your providers array:
Add the following to your `providers` array in `app/config/app.php`:

``` php
'providers' = [
Russoedu\ColorValidator\ColorValidatorServiceProvider::class,
]
```

<a name="usage"></a>
## Usage

#### Standalone

```php
use Olssonm\IdentityNumber\IdentityNumber as Pin;

Pin::isValid('19771211-2775');
// true
```

#### Laravel 5

The package extends the `Illuminate\Validator` via a service provider, so all you have to do is use the `personal_identity_number`-rule.
The package extends the `Illuminate\Validator` via a service provider, so all you have to do is use the `hex_color`-rule.

``` php
public function store(Request $request) {
$this->validate($request, [
'pnr' => 'personal_identity_number'
'color' => 'hex_color'
]);
}
```
Expand All @@ -51,9 +43,9 @@ Of course, you can roll your own error messages:

``` php
$validator = Validator::make($request->all(), [
'pnr' => 'personal_identity_number'
'color' => 'hex_color'
], [
'pnr.personal_identity_number' => "Hey! That's not a personnummer!"
'color.hex_color' => "Hey! That's not real color!"
]);

if($validator->fails()) {
Expand All @@ -63,18 +55,7 @@ if($validator->fails()) {

If you're using the validation throughout your application, you also might want to put the error message in your lang-files.

## Testing

``` bash
$ composer test
```

or

``` bash
$ phpunit
```

<a name="license"></a>
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "russoedu/colorvalidator",
"description": "Custom Laravel 5 Validator for hexadecimal color",
"keywords": ["laravel5","validator","color"],
"keywords": ["laravel", "laravel5", "validator","color"],
"homepage": "https://github.com/russoedu/colorvalidator",
"license": "MIT",
"authors": [
Expand Down
18 changes: 0 additions & 18 deletions phpunit.xml

This file was deleted.

0 comments on commit 13194c4

Please sign in to comment.