Need help with laravel-multisite?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

216 Stars 28 Forks MIT License 49 Commits 1 Opened issues


Multiple sites on one codebase

Services available


Need anything else?

Contributors list

Laravel Multisite

Latest Version on Packagist Total Downloads Software License Build Status

With this package it is possible to build multiple sites/(sub)domains on one codebase.


You can install the package via composer:

composer require appstract/laravel-multisite

Config (hosts, homestead)

You need to add the sites to your

file and
. For example,
. In the
, you need to map the sites to the same folder.


By running

php artisan vendor:publish --provider="Appstract\Multisite\MultisiteServiceProvider"
in your project all files for multisite will be published. The files that will be published are: a migration, a seeder and a config file.


The seeder will be published but needs to be run when running

php artisan db:seed
, so you need the add
to your
file. After migrating and seeding the sites are now present in the database.


This is the main part, within your

you can set routes for your sites within route groups, like this:
    'domain' => 'blog.'.config(''),
    'as' => 'blog.',
    'middleware' => 'site:blog'
], function () {
    Route::get('/', '[email protected]')->name('homepage');

The magic happens with the site middleware

. This will tell your app that the routes within the group are belonging to the blog. It will provide a variable called
in all your views. There is also a config available, which you can access with


$ composer test


Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.


The MIT License (MIT). Please see License File for more information.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.