{"id":22739955,"url":"https://github.com/inacho/php-credit-card-validator","last_synced_at":"2025-04-12T06:18:55.525Z","repository":{"id":21312227,"uuid":"24628775","full_name":"inacho/php-credit-card-validator","owner":"inacho","description":"Validates popular debit and credit cards numbers against regular expressions and Luhn algorithm. Also validates the CVC and the expiration date.","archived":false,"fork":false,"pushed_at":"2023-08-22T08:27:12.000Z","size":232,"stargazers_count":202,"open_issues_count":22,"forks_count":104,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-12T06:18:46.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inacho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-30T07:31:26.000Z","updated_at":"2025-02-08T14:40:37.000Z","dependencies_parsed_at":"2024-06-18T11:13:16.566Z","dependency_job_id":"029f5cf3-5957-4a8c-b9ed-81ced964c389","html_url":"https://github.com/inacho/php-credit-card-validator","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":0.6521739130434783,"last_synced_commit":"af3bab9af09dd159fbd23815ab08b1092d7fa963"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inacho%2Fphp-credit-card-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inacho%2Fphp-credit-card-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inacho%2Fphp-credit-card-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inacho%2Fphp-credit-card-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inacho","download_url":"https://codeload.github.com/inacho/php-credit-card-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525140,"owners_count":21118620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T23:06:55.493Z","updated_at":"2025-04-12T06:18:55.484Z","avatar_url":"https://github.com/inacho.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Credit Card Validator\n\n[![Build Status](https://travis-ci.org/inacho/php-credit-card-validator.svg?branch=master)](https://travis-ci.org/inacho/php-credit-card-validator) [![Coverage Status](https://coveralls.io/repos/inacho/php-credit-card-validator/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/inacho/php-credit-card-validator?branch=master) [![Latest Stable Version](https://poser.pugx.org/inacho/php-credit-card-validator/version)](https://packagist.org/packages/inacho/php-credit-card-validator) [![Total Downloads](https://poser.pugx.org/inacho/php-credit-card-validator/downloads)](https://packagist.org/packages/inacho/php-credit-card-validator)\n\nValidates popular debit and credit cards numbers against regular expressions and Luhn algorithm.\nAlso validates the CVC and the expiration date.\n\n## Installation\n\nRequire the package in `composer.json`\n\n```json\n\"require\": {\n    \"inacho/php-credit-card-validator\": \"1.*\"\n},\n```\n\nIf you are using Laravel, add an alias in `config/app.php`\n\n```php\n'aliases' =\u003e array(\n\n    'App'             =\u003e 'Illuminate\\Support\\Facades\\App',\n    ...\n    'View'            =\u003e 'Illuminate\\Support\\Facades\\View',\n\n    'CreditCard'      =\u003e 'Inacho\\CreditCard',\n\n),\n```\n\n## Usage\n\n### Validate a card number knowing the type:\n\n```php\n$card = CreditCard::validCreditCard('5500005555555559', 'mastercard');\nprint_r($card);\n```\n\nOutput:\n\n```\nArray\n(\n    [valid] =\u003e 1\n    [number] =\u003e 5500005555555559\n    [type] =\u003e mastercard\n)\n```\n\n### Validate a card number and return the type:\n\n```php\n$card = CreditCard::validCreditCard('371449635398431');\nprint_r($card);\n```\n\nOutput:\n\n```\nArray\n(\n    [valid] =\u003e 1\n    [number] =\u003e 371449635398431\n    [type] =\u003e amex\n)\n```\n\n### Validate the CVC\n\n```php\n$validCvc = CreditCard::validCvc('234', 'visa');\nvar_dump($validCvc);\n```\n\nOutput:\n\n```\nbool(true)\n```\n\n### Validate the expiration date\n\n```php\n$validDate = CreditCard::validDate('2013', '07'); // past date\nvar_dump($validDate);\n```\n\nOutput:\n\n```\nbool(false)\n```\n\n## Tests\n\nExecute the following command to run the unit tests:\n\n    vendor/bin/phpunit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finacho%2Fphp-credit-card-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finacho%2Fphp-credit-card-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finacho%2Fphp-credit-card-validator/lists"}