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

More Decks by Freek Van der Herten

Other Decks in Programming


  1. A practical look at multitenancy in Laravel

  2. About me Freek Van der Herten @freekmurze spatie.be ohdear.app flareapp.io

  3. spatie.be/open-source

  4. spatie.be/videos

  5. spatie.be/videos

  6. Multitenancy in Laravel

  7. 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
  8. spatie.be/docs/laravel-multitenancy

  9. 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
  10. Multi DB Demo & Source Dive

  11. 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
  12. 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
  13. One more thing…

  14. Do you ever work on client projects?

  15. 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
  16. laravel-beyond-crud.com

  17. 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
  18. laravel-beyond-crud.com 25% discount: THANKS-FOR-WATCHING-PHP-LONDON Valid for two weeks Works for

    everything listed at spatie.be/products
  19. Thank you! spatie.be/docs/laravel-multitenancy freek.dev/1661-multitenancy-in-laravel spatie.be/products ohdear.app