Skip to content

Commit 736f138

Browse files
author
Rob Allport
committed
first commit
0 parents  commit 736f138

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2211
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.editorconfig export-ignore
12+
/docs export-ignore

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build
2+
composer.lock
3+
docs
4+
vendor
5+
.idea
6+
phpcs.xml
7+
phpunit.xml
8+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
filter:
2+
excluded_paths: [tests/*, vendor/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: psr12

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: php
2+
3+
php:
4+
- 7.2
5+
- 7.3
6+
- 7.4
7+
8+
env:
9+
matrix:
10+
- Laravel=7.x
11+
- Laravel=6.x
12+
- Laravel=5.8.x
13+
14+
install:
15+
- travis_retry composer require --dev "laravel/framework:${Laravel}" --no-interaction
16+
17+
script:
18+
- vendor/bin/phpunit

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) F9WebLtd <rob@f9web.co.uk>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Useful Laravel Validation Rules
2+
3+
Some useful Laravel validation rules.
4+
5+
## Available rules
6+
7+
* Simple API
8+
* Laravel `>=5.8 | 6.x | 7.x` are supported
9+
* Render named, property type, raw, Twitter card and OpenGraph tags
10+
* Render default tags on every request
11+
* There is no need to set meta titles for every controller method. The package can optionally guess titles based on uri segments or the current named route
12+
* Well documented
13+
14+
## Requirements
15+
16+
PHP >= 7.2, Laravel >= 5.8.
17+
18+
## Installation
19+
20+
``` bash
21+
composer require f9webltd/laravel-meta
22+
```
23+
24+
The package will automatically register itself.
25+
26+
## Usage
27+
28+
As discussed in the official [Laravel documentation](https://laravel.com/docs/master/validation#using-rule-objects), import the required rule whenever required:
29+
30+
```php
31+
use F9Web\ValidationRules\Rules\TitleCase;
32+
33+
// ...
34+
35+
$request->validate([
36+
'team' => ['required', new TitleCase()],
37+
]);
38+
```
39+
40+
Alternatively use the rule directly with a [Laravel form request object](https://laravel.com/docs/7.x/validation#form-request-validation)
41+
42+
## Available rules
43+
44+
To follow ...
45+
46+
## Contribution
47+
48+
Any ideas are welcome. Feel free to submit any issues or pull requests.
49+
50+
## Testing
51+
52+
``` bash
53+
composer test
54+
```
55+
56+
## Security
57+
58+
If you discover any security related issues, please email rob@f9web.co.uk instead of using the issue tracker.
59+
60+
## Credits
61+
62+
- [Rob Allport](https://github.com/ultrono)
63+
64+
## License
65+
66+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "f9webltd/laravel-validation-rules",
3+
"description": "Some useful Laravel validation rules",
4+
"keywords": [
5+
"laravel",
6+
"laravel validation rules",
7+
"laravel validation",
8+
"custom laravel validation",
9+
"laravel request validation"
10+
],
11+
"homepage": "https://github.com/f9webltd/laravel-validation-rules",
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "Rob Allport",
16+
"email": "rob@f9web.co.uk",
17+
"homepage": "https://www.f9web.co.uk",
18+
"role": "Developer"
19+
}
20+
],
21+
"require": {
22+
"php": "^7.2",
23+
"ext-mbstring": "*",
24+
"illuminate/support": "5.8.* || ^6.0 || ^7.0"
25+
},
26+
"require-dev": {
27+
"orchestra/testbench": ">=3.8",
28+
"phpunit/phpunit": "^7.0|^8.0"
29+
},
30+
"autoload": {
31+
"psr-4": {
32+
"F9Web\\ValidationRules\\": "src"
33+
}
34+
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"F9Web\\ValidationRules\\Tests\\": "tests"
38+
}
39+
},
40+
"scripts": {
41+
"test": "vendor/bin/phpunit",
42+
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
43+
},
44+
"config": {
45+
"sort-packages": true
46+
},
47+
"extra": {
48+
"laravel": {
49+
"providers": [
50+
"F9Web\\ValidationRules\\ValidationRulesServiceProvider"
51+
]
52+
}
53+
},
54+
"minimum-stability": "dev",
55+
"prefer-stable": true
56+
}

phpunit.xml.dist

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Laravel Validation Rules">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>

0 commit comments

Comments
 (0)