Skip to content

Commit de927ca

Browse files
author
Ariful Alam
committed
Add doc for rule username
1 parent 3120441 commit de927ca

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function rules()
5454
- [`Float Number`](#floatnumber)
5555
- [`Image URL`](#imageurl)
5656
- [`Phone`](#phone)
57+
- [`Username`](#username)
5758
- [`Without Spaces`](#withoutspaces)
5859

5960

@@ -244,6 +245,26 @@ public function rules()
244245
}
245246
```
246247

248+
### `Username`
249+
250+
The field under validation must be a valid username.
251+
252+
- starts with a letter (alpha)
253+
- only alpha-numeric (a-z, A-Z, 0-9), underscore, minus and dot
254+
- multiple underscores, minus and are not allowed (-- or __ or ..)
255+
- underscores, minus and dot are not allowed at the beginning or end
256+
257+
```php
258+
use Arifszn\AdvancedValidation\Rules\Username;
259+
260+
public function rules()
261+
{
262+
return [
263+
'username' => [new Username()],
264+
];
265+
}
266+
```
267+
247268
### `WithoutSpaces`
248269

249270
The field under validation must not contain spaces.

0 commit comments

Comments
 (0)