Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A practical look at multitenancy in Laravel

A practical look at multitenancy in Laravel

Freek Van der Herten

September 16, 2020
Tweet

More Decks by Freek Van der Herten

Other Decks in Programming

Transcript

  1. What is multitenancy? A single application that serves several (groups

    of) users Users/teams cannot see data of other users/teams Multiple approaches: single database, multiple databases Tom Schlick at Laracon US: youtube.com/watch?v=T-gHOXFpZvg
  2. spatie/laravel-multitenancy 1. Determine which tenant should be made current 2.

    Dynamically change configuration when switching tenant 3. Light tooling for migrations and running artisan commands
  3. Laravel Multitenancy A lightweight package Adapt to your own needs

    Single and multiple databases strategies spatie.be/docs/laravel-multitenancy github.com/spatie/laravel-multitenancy#alternatives
  4. Do you really need a package for multitenancy? Multitenancy seems

    daunting, but can be simple Take care of it yourself Steal the implementation of the package One less dependency to worry about
  5. Mostly very large ones that take months or years to

    complete laravel-multitenancy, laravel-event-sourcing, laravel-view-models, … Good way of building larger than average apps
  6. laravel-beyond-crud.com Book + premium video course A way of building

    large maintainable Laravel apps Many principles applicable to smaller projects as well 25% discount: THANKS-FOR-WATCHING-PHP-LONDON