Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 3 KB

File metadata and controls

76 lines (59 loc) · 3 KB

Contributing

Thanks for looking. This package is small on purpose, and the bar for changes reflects that.

Ground rules

  • Zero runtime dependencies, zero lifecycle scripts. PRs that add either will be declined regardless of what they buy. The Laravel and Symfony bridges stay optional: nothing in src/Laravel or src/Symfony may be referenced from the core.
  • Every change to src/Networks.php needs a source — a network's published IIN allocation, an ISO/IEC 7812 reference, or equivalent. "Another library uses this range" is not a source; several of them are wrong in the same way, which is half the reason this package exists.
  • Bug fixes come with a test that fails before the fix and passes after.
  • The same rule table also runs the generators on ccgenerator.org and the npm package — table changes are synced across all three, so expect a short delay between merge and release.

What gets merged

  • IIN range corrections with a citation.
  • Bug fixes with tests.
  • Support for a framework version that is still maintained upstream.
  • Documentation fixes.

What does not

  • New dependencies, build steps, or CI complexity.
  • Anything that makes the output resemble real card data more closely — balances, cardholder identities, issuer names attached to numbers. The package generates structurally valid test input, and that boundary is deliberate.
  • Support for producing gateway-specific sandbox numbers (Stripe's 4242… and friends). Those are assigned by the gateway, not derived from any rule, so no amount of code here can produce them. Use the provider's own list.

Running the tests

composer install
composer test

128 tests, no external services, no network. The Laravel suite runs on Testbench and the Symfony suite builds a real container, so both bridges are exercised rather than described.

There is one suite per optional dependency, so a runtime that cannot install a bridge can still run everything else:

vendor/bin/phpunit --testsuite unit
vendor/bin/phpunit --testsuite symfony
vendor/bin/phpunit --testsuite laravel
vendor/bin/phpunit --testsuite unit,faker,symfony   # what CI runs on PHP 8.1

PHP 8.1 is the live case for that split: no Testbench release supports it any more, because the only one that ever did resolves against Laravel 10, which Composer now blocks on security advisories. The core and the Symfony bridge still support 8.1 and are tested there.

Translations

The validation messages live in lang/<locale>/validation.php. A new locale is a copy of lang/en/validation.php with the same keys and the same placeholders — TranslationsTest fails the build if either drifts, because a missing key ships a raw translation string to a customer.

Coding style

PSR-12, declare(strict_types=1) in every file, and comments that explain why rather than restating the code. The existing files are the reference.