Laravel for Rust Alpha

laravel-rust-ogm

Generate, parse, validate and format Belgian structured payment references (OGM/VCS) in Laravel for Rust, ported from ruudvdd/ogm.

Rust port of ruudvdd/ogm: generate, parse and validate Belgian structured payment references (OGM/VCS).

Read the docs Source on GitHub

cargo add laravel-rust-ogm
Latest release
0.1.0, 2026-12-04
Maintenance
Active
Framework
laravel-rust 0.2.x
MSRV
Rust 1.99 or later
Licence
MIT

PHP parity

Follows ruudvdd/ogm 0.2.0 (commit 70ad9dde124f). Last verified .

Parity level
Full
Abilities
9
Covered
4
Diverged
5
Planned
0
PHP fixtures
55

Fixtures are generated by PHP itself: PHP 8.4, ruudvdd/ogm 0.2.0.

Coverage by ability
  • ogm.generate.plain · Covered · Core · 3 tests
    Generator::generate(false): exact for a 10-digit prefix; with a shorter prefix the port draws its own random sequence, not PHP's seeded mt_rand, and each output passes the mod-97 check on its own (they can coincide only by chance)
  • ogm.generate.formatted · Covered · Core · 3 tests
    Generator::generate(true): exact for a 10-digit prefix; with a shorter prefix the port draws its own random sequence, not PHP's seeded mt_rand, and each output passes the mod-97 check on its own (they can coincide only by chance)
  • ogm.generate.prefix · Covered · Core · 5 tests
    Generator::generate($formatted, $prefix): exact for a 10-digit prefix; with a shorter prefix the port draws its own random sequence, not PHP's seeded mt_rand, and each output passes the mod-97 check on its own (they can coincide only by chance)
  • ogm.generate.prefix_too_long · Covered · Core · 2 tests
    Ruudvdd\OGM\Exception\TooMuchDigits
  • ogm.generate.prefix_type · Diverged · Core
    Generator::guardInputType (non-string/int/null or non-digit prefix)
  • ogm.validate.structured · Diverged · Core
    Validator::isValid($ogm)
  • ogm.validate.digits · Diverged · Core
    Validator::digitsAreValid($number)
  • ogm.cli.generate · Diverged
    bin/ogm generate [-c] [PREFIX]
  • ogm.cli.validate · Diverged
    bin/ogm validate [-c] OGM

Differences from PHP

Generator::guardInputType (non-string/int/null or non-digit prefix)
Rust's &str parameter enforces string input at compile time, and non-ASCII-digit prefixes return OgmError::InvalidPrefix (checked before PrefixTooLong), avoiding PHP's silent coercion of leading spaces and negative ints, % warnings/TypeError, and TooMuchDigits-before-coercion precedence.
Validator::isValid($ogm)
Accepts both +++XXX/XXXX/XXXXX+++ and ***XXX/XXXX/XXXXX*** (fixing PHP's str_replace bug that rejects ***...***), and rejects trailing newlines in strict mode.
Validator::digitsAreValid($number)
Strictly requires 12 ASCII digits, fixing PHP's (int) cast coercion that accepts non-digit strings like abcdefghij97.
bin/ogm generate [-c] [PREFIX]
Library crate for Laravel for Rust; no standalone CLI binary is shipped.
bin/ogm validate [-c] OGM
Library crate for Laravel for Rust; no standalone CLI binary is shipped.

Built on

  • ruudvdd/ogm: The Belgian structured payment reference package this ports: the generator, the validator and the mod-97 check, following version 0.2.0.

Crates: laravel-rust-ogm · Upstream notices

Documentation