1. Go to this page and download the library: Download dragon-code/card-number library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use DragonCode\CardNumber\Formatters\Formatter;
class SomeFormatter extends Formatter
{
protected int $splitLength = 6;
protected string $delimiter = '/';
}
use App\Cards\Formatters\SomeFormatter;
use DragonCode\CardNumber\CardNumber;
$formatter = SomeFormatter::create();
CardNumber::generate(558047337202473, $formatter); // 5580/473372/024733
use DragonCode\CardNumber\CardNumber;
use DragonCode\CardNumber\Formatters\LoyaltyCharFormatter;
$formatter = LoyaltyCharFormatter::create();
CardNumber::generate(345678123, $formatter); // KN-OSXY-AEKF
use DragonCode\CardNumber\CardNumber;
use DragonCode\CardNumber\Factories\CustomerFactory;
use DragonCode\CardNumber\Formatters\LoyaltyFormatter;
$formatter = LoyaltyFormatter::create();
$customer = CustomerFactory::create()->level($user->loyalty_level)->customer($user->id);
return CardNumber::generate($customer, $formatter);
// For example, 230-4001-2348
//
// 23 - year
// 04 - loyalty level
// 001234 - user id
// 8 - control digit
use DragonCode\CardNumber\CardNumber;
use DragonCode\CardNumber\Factories\BankFactory;
use DragonCode\CardNumber\Formatters\BankFormatter;
$formatter = BankFormatter::create();
$customer = BankFactory::create()->paymentType(3)->bank(12, 45, 75)->client(12345);
return CardNumber::generate($customer, $formatter);
// 3012 4575 0012 3452
//
// 3 - payment type
// 012 - bank ID
// 45 - bank info
// 75 - bank's program
// 0012345 - client id
// 2 - control digit
use DragonCode\CardNumber\Laravel\Validation\Rules\CardNumberRule;
use Illuminate\Foundation\Http\FormRequest;
class SomeRequest extends FormRequest
{
public function rules(): array
{
return [
'number' => ['
use DragonCode\CardNumber\Enums\CardType;
use DragonCode\CardNumber\Laravel\Validation\Rules\CardNumberRule;
use Illuminate\Foundation\Http\FormRequest;
class SomeRequest extends FormRequest
{
public function rules(): array
{
return [
'visa_card_1' => [' }
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.