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

JonnoBailey's avatar

Dynamic Routing for a Multi-Tenant Application

Hi everyone,

I'm pretty new to Laravel - I have got the basics down and have already created a couple of applications.

I am starting a new project - it's a Multi-Tenant Application and I'm struggling getting dynamic routing working.

As I have already said it's a Multi-Tenant Application. Tenants (customers) will all administer their instance from example.com/admin, they will then have their own subdomain instance at tenant.example.com and will also be able to point their own domain via an A Record to their instance.

The application will be modular, let's say one of the modules which we will be able to activate on an instance by instance basis is called Shop. Not all instances will have a shop module.

How do I set the application up so that each instance can have it's own dynamic routing. If the Shop module is activated in the database, their instance will then have a /shop endpoint along with /shop/checkout, cart, products etc.

Furthermore, some tenants' instances may wish for the Shop module to be accessible at /merchandise or any other endpoint - every other Shop Module endpoint would then be effected eg /merchandise/checkout, cart.

The admin routing should be simple as there won't be any routes which can't be accounted for and coded directly into the routes file.

Any help would be appreciated. I have created a similar application using "vanilla" PHP in the past but would really like to use Laravel for this project as in time, all of our applications will be running on Laravel (all future projects and older ones will be migrated and re-developed).

I know that this is a very large project I just need a leg-up with the routing!

Thanks everyone in advance!

0 likes
1 reply
jlrdw's avatar

Been recently done, very recent google:

site:laracasts.com multi tenant
or
site:laracasts.com dynamic routing
and
other terms you enter

Please or to participate in this conversation.