credit_cards.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Credit card validation configuration.
  4. *
  5. * Options for each credit card:
  6. * length - All the allowed card number lengths, in a comma separated string
  7. * prefix - The digits the card needs to start with, in regex format
  8. * luhn - Enable or disable card number validation by the Luhn algorithm
  9. */
  10. return [
  11. 'default' => [
  12. 'length' => '13,14,15,16,17,18,19',
  13. 'prefix' => '',
  14. 'luhn' => TRUE,
  15. ],
  16. 'american express' => [
  17. 'length' => '15',
  18. 'prefix' => '3[47]',
  19. 'luhn' => TRUE,
  20. ],
  21. 'diners club' => [
  22. 'length' => '14,16',
  23. 'prefix' => '36|55|30[0-5]',
  24. 'luhn' => TRUE,
  25. ],
  26. 'discover' => [
  27. 'length' => '16',
  28. 'prefix' => '6(?:5|011)',
  29. 'luhn' => TRUE,
  30. ],
  31. 'jcb' => [
  32. 'length' => '15,16',
  33. 'prefix' => '3|1800|2131',
  34. 'luhn' => TRUE,
  35. ],
  36. 'maestro' => [
  37. 'length' => '16,18',
  38. 'prefix' => '50(?:20|38)|6(?:304|759)',
  39. 'luhn' => TRUE,
  40. ],
  41. 'mastercard' => [
  42. 'length' => '16',
  43. 'prefix' => '5[1-5]',
  44. 'luhn' => TRUE,
  45. ],
  46. 'visa' => [
  47. 'length' => '13,16',
  48. 'prefix' => '4',
  49. 'luhn' => TRUE,
  50. ],
  51. ];