kphoen/rusty
Rusty brings Rust-inspired Result and Option types to PHP and Laravel, enabling explicit error handling and nullable values without exceptions or scattered null checks. Fluent helpers make safer, more expressive code easy to write.
Consider the pattern (and read this repo as the reference implementation) when:
eval or a generated temp file) against your security review, static-analysis stack (PHPStan/Psalm will not see through it), and coverage tooling.Look elsewhere — or drop the idea — when:
eval in CI or requires full static-analysis coverage of test code — a hard blocker regardless of package quality.@example/data providers, address that need with maintained tooling. For docblock correctness (types, signatures) rather than behaviour, PHPStan/Psalm already do the job.To executives (30 seconds): This is a small, archived open-source tool that turns code samples in documentation into automatically-run tests — the same idea Rust uses, ported to PHP. We are not recommending adoption: it's unmaintained, has no downstream users, and won't run on our current PHP/PHPUnit versions. We are recommending we copy the idea for our developer-facing SDK, where broken examples are a recurring, quantifiable support cost. Estimated cost: 1–3 engineer-days to build a minimal in-house version, with no new dependency and no maintenance risk. Success metric: reduction in "example doesn't work" support tickets and time-to-first-successful-call for integrators.
To engineering (the real pitch):
eval-based) is opaque to PHPStan/Psalm and to coverage tooling.```php blocks out of docblocks, writes each to a temp file, and asserts it runs clean — scoped to our public SDK namespace only. Roughly a few hundred lines, PHPUnit-version-agnostic, no eval, and we control the sandbox.The one-line framing: Rusty is a design reference, not a dependency — buy the idea, build the twenty lines that matter.
How can I help you explore Laravel packages today?