https://github.com/vyuldashev/cards
API for bank cards
https://github.com/vyuldashev/cards
bank bank-card bind card pan pci-dss php7
Last synced: about 1 year ago
JSON representation
API for bank cards
- Host: GitHub
- URL: https://github.com/vyuldashev/cards
- Owner: vyuldashev
- License: mit
- Created: 2017-09-19T22:31:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-20T15:52:54.000Z (over 8 years ago)
- Last Synced: 2024-10-06T02:23:09.963Z (over 1 year ago)
- Topics: bank, bank-card, bind, card, pan, pci-dss, php7
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cards
This package provides an API for bank cards. Card object is a value object and cannot be modified.
Also, this package takes care of secure serialization and deserialization of card information and provides an API for bin data information retrieval.
## Installation
You can install the package via composer:
```bash
composer require vyuldashev/cards
```
## Usage
```php
use Vyuldashev\Cards\Card;
Card::create('4916080075115045'); // Vyuldashev\Cards\Visa::class
Card::create('5258369670492716'); // Vyuldashev\Cards\MasterCard::class
```
Pan may also contain non-numeric characters, method `create` will remove these characters itself.
```php
Card::create('4916-0800-7511-5045'); // 4916080075115045
```
Create card with passing expiration month, expiration year and cvv. Each argument is optional:
```php
Card::create('4916080075115045', 3, 2021, 123);
```
If card type cannot be identified, `Unknown` card instance will be returned.
```php
Card::create('8888888888888888'); // Vyuldashev\Cards\Unknown::class
```