Migrating from PHP

laravel-go-credit-card Alpha Laravel for Go

Use these Go functions and Laravel for Go rules when moving a form from laravel-validation-rules/credit-card.

PHPGo
Factory::makeFromNumber($number)creditcard.Parse(number)
new Visa($number)Look up creditcard.BrandNamed("visa"), then call brand.Parse(number)
CardNumbercreditcard.Number()
CardCvccreditcard.CVC() or creditcard.CVCFrom("number")
CardExpirationYearcreditcard.ExpirationYear()
CardExpirationMonthcreditcard.ExpirationMonth()
CardExpirationDate('m/y')creditcard.ExpirationDate("m/y")
ExpirationDateValidator::validatecreditcard.ValidExpiration(year, month, now)
MSG_*creditcard.Key* constants

To pass a companion value directly, use CVCFor(number), ExpirationYearFor(month) or ExpirationMonthFor(year).

Add rule.Required to mandatory fields. Laravel for Go skips these rules on missing, null and blank fields. Configure DontFlash for every card number and CVC field before accepting checkout form submissions.

The Go rule messages default to English. Use Message or MessageFor with an exported Key* constant if your application expects translation keys. Parsing strips ASCII whitespace before brand recognition. Validation failures expose a fixed category or message without submitted values.