mirror of
https://github.com/Respect/Validation.git
synced 2024-06-21 06:55:07 +02:00
The current documentation is hosted via GitHub pages rendered by "Couscous". Every time we need a new version of the documentation published we need to manually execute the "couscous". This commit reorganize the documentation to be published to "Read the Docs" because it will also allow us to have documentations per version of the library most importantly provider a search field for the documentation. The documentation will be then published on: https://respect-validation.readthedocs.io/ Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
40 lines
898 B
Markdown
40 lines
898 B
Markdown
# CreditCard
|
|
|
|
- `v::creditCard()`
|
|
- `v::creditCard(string $brand)`
|
|
|
|
Validates a credit card number.
|
|
|
|
```php
|
|
v::creditCard()->validate('5376 7473 9720 8720'); // true
|
|
|
|
v::creditCard('American Express')->validate('340316193809364'); // true
|
|
v::creditCard('Diners Club')->validate('30351042633884'); // true
|
|
v::creditCard('Discover')->validate('6011000990139424'); // true
|
|
v::creditCard('JCB')->validate('3566002020360505'); // true
|
|
v::creditCard('Master')->validate('5376747397208720'); // true
|
|
v::creditCard('Visa')->validate('4024007153361885'); // true
|
|
```
|
|
|
|
The current supported brands are:
|
|
|
|
- American Express
|
|
- Diners Club
|
|
- Discover
|
|
- JCB
|
|
- MasterCard
|
|
- Visa
|
|
|
|
It ignores any non-digit chars, so use `->digit()` when appropriate.
|
|
|
|
```php
|
|
v::digit()->creditCard()->validate('5376747397208720'); // true
|
|
```
|
|
|
|
***
|
|
See also:
|
|
|
|
* [Bank](Bank.md)
|
|
* [BankAccount](BankAccount.md)
|
|
* [Bic](Bic.md)
|