madeitbelgium/spintax
Process spintax templates in Laravel with madeitbelgium/spintax. Expand {a|b|c} syntax into random variations for emails, copy, and SEO content, with a simple API that integrates cleanly into any PHP or Laravel app.
{Hello|Hi|Hey} pattern — for personalized email greetings, subject-line rotation, marketing copy variants, and notification text. This is the core product feature the package directly de-risks.Adopt when:
{Hi|Hello {friend|there}}) and don't want to hand-roll recursion.Look elsewhere when:
To executives: This is a tiny, MIT-licensed utility that lets us add content-personalization features (varied greetings, rotating subject lines, A/B copy) without building a parser ourselves. Cost is effectively zero, risk is low because we can vendor the source into our codebase. It's a tactical accelerator, not a strategic bet — no vendor lock-in, no license exposure.
To engineering: It's a small, framework-agnostic PHP library with an optional Laravel service provider and facade. It parses nested {a|b|c} spintax and returns a random variation — clean to integrate, minimal surface area. Caveat: last release was mid-2022 and adoption is minimal, so treat it as vendorable source: pin the version, write a thin wrapper around the API so we can swap or fork it, and add tests around the nested/edge cases. If we'd rather not own a third-party dependency for ~100 lines of logic, porting the parser in-house is a reasonable alternative.
How can I help you explore Laravel packages today?