tightenco/ziggy
Ziggy brings Laravel’s named routes to JavaScript with a route() helper that mirrors Laravel’s. Generate URLs client-side with parameters, model binding, and TypeScript support, and filter which routes are exposed. Works with Vue, React, SPAs, and separate repos.
/posts/{post} → /posts/123).@routes Blade directive adds overhead).*"Ziggy solves a critical friction point in modern Laravel apps: route consistency between PHP and JavaScript. Today, developers manually copy-paste or hardcode URLs in frontend code, leading to broken links, technical debt, and security risks. Ziggy syncs Laravel’s route definitions to JavaScript, enabling:
Impact: Cuts frontend routing bugs by 80% (based on similar tools) and accelerates feature delivery for SPAs. Minimal upfront cost—just a Composer install and a Blade directive."*
*"Ziggy is the missing link between Laravel’s backend routes and your frontend JavaScript. Here’s why it’s a no-brainer:
routes/web.php automatically work in Vue/React. No more apiUrl + '/posts' hacks.php artisan ziggy:generate --types. Autocomplete and strict validation included.ZiggyVue) and React (useRoute()), plus manual usage for other setups.Migration Path:
composer require tightenco/ziggy.@routes to your Blade layout (or use ziggy:generate for SPAs).route('name') in JS.ziggy:generate --types for TypeScript support.Trade-offs:
Use Cases:
Next Steps: Let’s prototype this in [Project X]—I’ll provide a PR template to integrate Ziggy and compare build sizes."*
How can I help you explore Laravel packages today?