PHP code example of laravel-validation-rules / credit-card
1. Go to this page and download the library: Download laravel-validation-rules/credit-card 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/ */
laravel-validation-rules / credit-card example snippets
namespace App\Http\Requests;
use LVR\CreditCard\CardCvc;
use LVR\CreditCard\CardNumber;
use LVR\CreditCard\CardExpirationYear;
use LVR\CreditCard\CardExpirationMonth;
use Illuminate\Foundation\Http\FormRequest;
class CreditCardRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'card_number' => ['
$request->validate(
['card_number' => '37873449367100'],
['card_number' => new LVR\CreditCard\CardNumber]
);
(new LVR\CreditCard\Cards\Visa)
->setCardNumber('4012888888881881')
->isValidCardNumber()