Skip to content

Commit ae3a274

Browse files
Updated doc
1 parent 64b24e2 commit ae3a274

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,99 @@
77
</p>
88

99
Symfony validation hổ trợ kiểm tra các kiểu dữ liệu đặc thù trong nước ta.
10+
11+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/phpviet/symfony-validation.svg?style=flat-square)](https://packagist.org/packages/phpviet/symfony-validation)
12+
[![Build Status](https://img.shields.io/travis/phpviet/symfony-validation/master.svg?style=flat-square)](https://travis-ci.org/phpviet/symfony-validation)
13+
[![Quality Score](https://img.shields.io/scrutinizer/g/phpviet/symfony-validation.svg?style=flat-square)](https://scrutinizer-ci.com/g/phpviet/symfony-validation)
14+
[![StyleCI](https://styleci.io/repos/188066562/shield?branch=master)](https://styleci.io/repos/188066562)
15+
[![Total Downloads](https://img.shields.io/packagist/dt/phpviet/symfony-validation.svg?style=flat-square)](https://packagist.org/packages/phpviet/symfony-validation)
16+
17+
## Cài đặt
18+
19+
+ Cài đặt Symfony Validation thông qua [Composer](https://getcomposer.org):
20+
21+
```bash
22+
composer require phpviet/symfony-validation
23+
```
24+
25+
+ Tiếp đến hãy khai báo bundle tại `config/bundles.php`:
26+
27+
```php
28+
// config/bundles.php
29+
30+
return [
31+
.....
32+
PHPViet\Symfony\Validation\Bundle::class => ['all' => true]
33+
];
34+
35+
```
36+
37+
## Cách sử dụng
38+
39+
### Các kiểu dữ liệu được hổ trợ kiểm tra hiện tại
40+
41+
- [`Số điện thoại di động`](#Số-điện-thoại-di-động)
42+
- [`Số điện thoại bàn`](#Số-điện-thoại-bàn)
43+
- [`Thẻ căn cước / chứng minh thư`](#Thẻ-căn-cước-/-chứng-minh-thư)
44+
- [`Địa chỉ IP`](#Địa-chỉ-IP)
45+
46+
### Số điện thoại di động
47+
48+
```php
49+
use PHPViet\Symfony\Validation\Constraints\MobileVN as AssertMobileVN;
50+
51+
/**
52+
* @AssertMobileVN
53+
*/
54+
private $mobileNumber;
55+
```
56+
57+
### Số điện thoại bàn
58+
59+
```php
60+
use PHPViet\Symfony\Validation\Constraints\LandLineVN as AssertLandLineVN;
61+
62+
/**
63+
* @AssertLandLineVN
64+
*/
65+
private $landLineNumber;
66+
```
67+
68+
### Thẻ căn cước / chứng minh thư
69+
70+
```php
71+
use PHPViet\Symfony\Validation\Constraints\IdVN as AssertIdVN;
72+
73+
/**
74+
* @AssertIdVN
75+
*/
76+
private $idVN;
77+
```
78+
79+
### Địa chỉ IP
80+
81+
```php
82+
use PHPViet\Symfony\Validation\Constraints\IpVN as AssertIpVN;
83+
84+
/**
85+
* @AssertIpVN
86+
*/
87+
private $ipVN;
88+
89+
/**
90+
* @AssertIpVN(version=4)
91+
*/
92+
private $ipv4VN;
93+
94+
/**
95+
* @AssertIpVN(version=6)
96+
*/
97+
private $ipv6VN;
98+
```
99+
100+
## Dành cho nhà phát triển
101+
102+
Nếu như bạn cảm thấy các kiểu kiểm tra dữ liệu bên trên vẫn chưa đủ đối với thị trường
103+
trong nước và bạn muốn đóng góp để phát triển chung, chúng tôi rất hoan nghênh!
104+
Hãy tạo các `issue` để đóng góp ý tưởng cho phiên bản kế tiếp hoặc tạo `PR`
105+
để đóng góp thêm các kiểu kiểm tra dữ liệu còn thiếu sót. Cảm ơn!

0 commit comments

Comments
 (0)