Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Ziggy for Laravel routes names in VueJS

Hello,

While testing InertiaJS, I also test Ziggy to use Laravel routes names directly in VueJS.

But is it really a good idea to use Ziggy ?

Even if Ziggy allows to filter the routes according to some user authorizations for example, it exposes all the filtered routes in the JS script.

Perhaps it would be better to write the routes directly and entirely in the different axios requests and/or InertiaJS links.

What do you think about that ?

Thanks for your participation ;).

Vincent

0 likes
3 replies
aleahy's avatar

I feel like I have the same hesitations as you do. I was looking into this exact thing a while ago, and the general concensus seemed to be that your routes should be protected with policies, etc anyway so exposing them should not make a difference. Still makes me feel uneasy though.

1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

I have an app that uses inertia for an app that only internal users can use. All routes are protected anyways, so I dont really care that they can see them. But I know that Johnathan, who wrote Inertia, dont use Ziggy himself but rather just write the routes when he needs them

Personally I just love the fact that I can change a route path and it just works, but if they dont change often, then this might not be worth much :)

1 like
vincent15000's avatar

@Sinnbeck That's a good point ... the possibility to change the route path without changing its name and it just continues working.

Please or to participate in this conversation.