From 65a5e31d76607e0465db4b47c3c952d288ffe9bd Mon Sep 17 00:00:00 2001 From: Ilya Chekalskiy Date: Mon, 2 Jul 2018 20:53:01 +0200 Subject: [PATCH] Readme update --- README.md | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e6e5dd1..2f7066d 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,42 @@ > It is a PHP port of [ramoona's banks-db](https://github.com/ramoona/banks-db). -Returns bank's name and brand color by bankcard prefix (BIN, Issuer Identification Numbers, IIN). - -> It's a community driven database, so it can potentially contains mistakes. - -For UI examples see the [original library](https://github.com/ramoona/banks-db). +Returns bank's name and brand color by bank card number's first digits (BIN, Issuer Identification Numbers, IIN). ### Installation ``` composer require chekalskiy/php-bank-db -``` \ No newline at end of file +``` + +### Basic usage + +```php +$card_prefix = $_GET['card_prefix']; // we only need first 6 digits + +try { + $bank_db = new BankDb(); + $bank_info = $bank_db->getBankInfo($card_prefix); + + $result = [ + 'is_unknown' => $bank_info->isUnknown(), // is bank unknown + 'name' => $bank_info->getName(true), + 'color' => $bank_info->getColor(), + 'type' => $bank_info->getCardType(), + ]; + + return $result; +} catch (BankDbException $e) { + // todo handle exception +} +``` + +### Contributions + +Feel free to open [an issue](https://github.com/chekalskiy/php-bank-db/issues) on every question you have. + +--- + +> It's a community driven database, so it can potentially contains mistakes. + +For UI examples see the [original library](https://github.com/ramoona/banks-db).