All Projects → appstract → Laravel Multisite

appstract / Laravel Multisite

Licence: mit
Multiple sites on one codebase

Projects that are alternatives of or similar to Laravel Multisite

Laravel Caffeine
Keeping Your Laravel Forms Awake.
Stars: ✭ 723 (+237.85%)
Mutual labels:  middleware, laravel, package
Htmlcache
Laravel middleware to cache the rendered html
Stars: ✭ 35 (-83.64%)
Mutual labels:  middleware, laravel, package
Laravel Analytics
Analytics for the Laravel framework.
Stars: ✭ 91 (-57.48%)
Mutual labels:  middleware, laravel, package
Laravel Rate Limited Job Middleware
A job middleware to rate limit jobs
Stars: ✭ 166 (-22.43%)
Mutual labels:  middleware, laravel
Request Migrations
HTTP Request Migrations for API Versioning like Stripe
Stars: ✭ 149 (-30.37%)
Mutual labels:  middleware, laravel
Nova Cashier Manager
Managing Stripe subscriptions inside the incredible Laravel Nova admin panel.
Stars: ✭ 150 (-29.91%)
Mutual labels:  laravel, package
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (-36.45%)
Mutual labels:  middleware, laravel
Laravel Http2 Server Push
A middleware package for Laravel to enable server push for your script, style, and image assets.
Stars: ✭ 174 (-18.69%)
Mutual labels:  middleware, laravel
Roadrunner Laravel
RoadRunner ⇆ Laravel bridge
Stars: ✭ 167 (-21.96%)
Mutual labels:  laravel, package
Laravel Custom Casts
Make your own custom cast type for Laravel model attributes
Stars: ✭ 213 (-0.47%)
Mutual labels:  laravel, package
Vue Gates
🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.
Stars: ✭ 184 (-14.02%)
Mutual labels:  middleware, laravel
Has Parameters
A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.
Stars: ✭ 149 (-30.37%)
Mutual labels:  middleware, laravel
Youtube
Upload a video to a single YouTube channel with Laravel 5.
Stars: ✭ 143 (-33.18%)
Mutual labels:  laravel, package
Laravel Location
A simple Laravel Package to sort Countries, States and Cities
Stars: ✭ 162 (-24.3%)
Mutual labels:  laravel, package
Laravel Paket
Composer GUI. Manage Laravel dependencies from web interface without switching to command line!
Stars: ✭ 143 (-33.18%)
Mutual labels:  laravel, package
Laravel Messenger
Simple user messaging package for Laravel
Stars: ✭ 2,140 (+900%)
Mutual labels:  laravel, package
Laravel Feature
A package to manage feature flagging in a Laravel project.
Stars: ✭ 184 (-14.02%)
Mutual labels:  laravel, package
Nebula
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.
Stars: ✭ 190 (-11.21%)
Mutual labels:  laravel, package
Laravel Shield
A HTTP basic auth middleware for Laravel
Stars: ✭ 193 (-9.81%)
Mutual labels:  middleware, laravel
L5 Very Basic Auth
Stateless HTTP basic auth for Laravel without the need for a database.
Stars: ✭ 127 (-40.65%)
Mutual labels:  middleware, laravel

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.

Installation

You can install the package via composer:

composer require appstract/laravel-multisite

Config (hosts, homestead)

You need to add the sites to your /etc/hosts file and Homestead.yaml. For example, mywebsite.dev and blog.mywebsite.dev. In the Homestead.yaml, you need to map the sites to the same folder.

Publish

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.

Seeder

The seeder will be published but needs to be run when running php artisan db:seed, so you need the add $this->call(SitesTableSeeder::class); to your DatabaseSeeder.php file. After migrating and seeding the sites are now present in the database.

Usage

This is the main part, within your routes/web.php you can set routes for your sites within route groups, like this:

Route::group([
    'domain' => 'blog.'.config('multisite.host'),
    'as' => 'blog.',
    'middleware' => 'site:blog'
], function () {
    Route::get('/', '[email protected]')->name('homepage');
});

The magic happens with the site middleware site:blog. This will tell your app that the routes within the group are belonging to the blog. It will provide a variable called $currentSite in all your views. There is also a config available, which you can access with Config::get('multisite.site').

Testing

$ composer test

Contributing

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.

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].