A flexible, seamless and easy to use multitenancy solution for Laravel

Overview

Packagist Version Packagist PHP Version Support GitHub Psalm Level Laravel

Main:

codecov CircleCI Mutation testing badge

Develop:

codecov CircleCI Mutation testing badge

Tenanted Laravel

A flexible, seamless and easy to use multitenancy solution for Laravel

This package is currently under development. Check back in the future, or check out my twitter, mastodon or discord for updates.

A quick FAQ

Here's a little FAQ that hopefully answers any questions you have for now.

Why are you building yet another multitenancy package for Laravel?

I feel like the currently available solutions leave something to be desired, as they're either very opinionated, or unnecessarily inflexible.

What sets this package apart?

It provides improvements on what is currently available, such as:

  • It is more flexible.
  • It is far more seamless.
  • It provides a greater degree of separation between your application logic and business logic.
  • It provides supporting functionality, either within this package or as an optional addon.
  • It doesn't tie you into one particular way of doing things.
  • It doesn't limit what you can do with Laravel.
  • It doesn't use magic to dynamically alter things, like the current default connection, because that really obfuscates what's happening.

Does it provide single and multi-database support?

Yes, either one on their own or as a combination.

Can I use dependency injection with my controller constructors?

Of course. Laravels container can successfully resolve controller dependencies that require a tenant, and inject them into the constructor, straight out of the box.

Wasn't this package originally premium?

It was, but I realised that I care far more about people having options than I do about getting paid.

Does this supersede the course?

No. This package is the code that I used to write the course, except it has been slightly modified so that it can function as a package.

While this package provides a solid base for your application, there are going to be times when it's better to write a custom solution.

Comments
  • Resolve tenants for routes

    Resolve tenants for routes

    Tenants will need to be resolved for routes, this should be done by:

    • [ ] Using a piece of middleware as a marker, to mark a route as requiring a tenant
      • [ ] Middleware should be aliased as tenanted
      • [ ] Middleware should also take two optional arguments, tenancy name and resolver name, i.e. tenanted:projects,subdomain
    • [ ] Listening for the RouteMatched event and resolving the tenant before the controller, to make use of DI
    • [ ] Optionally providing a fallback handler for when there's no route
    feat 
    opened by ollieread 0
  • Subdomain tenant resolver

    Subdomain tenant resolver

    Create an implementation of TenantResolver that uses a subdomain to identify the tenant.

    The implementation will require:

    • [ ] The domain the subdomains should belong to

    This implementation should:

    • [ ] Support the usage of a parameter named using the resolvers registered name, and the name of tenancy, i.e. project_subdomain
    • [ ] Fallback to extracting the subdomain from the current host, if no parameter is present
    • [ ] Implement the ActsAsMiddleware contract and set the default value of the parameter
    • [ ] Register routes with the appropriate middleware and set the domain to be a parameterised subdomain of the resolvers "main domain"
    opened by ollieread 0
  • Session tenant resolver

    Session tenant resolver

    Create an implementation of TenantResolver that uses the session to identify the tenant.

    The implementation will require:

    • An instance of Laravels Session class
    • An optional name of the session

    This implementation should:

    • [ ] Generate a session name if none is provided, using the name it was registered under, and the name of the tenancy, i.e. project_session.
    • [ ] Implement the ActsAsMiddleware contract, adding a value to the session if there's a tenant and the value isn't present
    • [ ] Register routes with the appropriate middleware
    feat 
    opened by ollieread 0
  • Path tenant resolver

    Path tenant resolver

    Create an implementation of TenantResolver that uses the path to identify the tenant.

    The implementation will require:

    • An optional segment index, defaulting to 0

    This implementation should:

    • [ ] Support the usage of a parameter named using the resolvers registered name, and the name of tenancy, i.e. project_path
    • [ ] Fallback to using the segment provided by the constructor, if no parameter is present
    • [ ] Implement the ActsAsMiddleware contract and set the default value of the parameter
    • [ ] Register routes with the appropriate middleware and path prefix using the parameter
    feat 
    opened by ollieread 0
  • Header tenant resolver

    Header tenant resolver

    Create an implementation of TenantResolver that uses a header to identify the tenant.

    The implementation will require:

    • An optional name for the header

    This implementation should:

    • [ ] Generate a header name if none is provided, using the name of the tenancy formatted as a header, i.e. Project
    • [ ] Implement the ActsAsMiddleware contract, that when a Response is generated, will make sure the header is present
    • [ ] Register routes with the appropriate middleware
    feat 
    opened by ollieread 0
  • Cookie tenant resolver

    Cookie tenant resolver

    Create an implementation of TenantResolver that uses a cookie to identify the tenant.

    The implementation will require:

    • An instance of Laravels CookieJar
    • An optional name for the cookie

    This implementation should:

    • [ ] Generate a cookie name if none is provided, using the name it was registered under, and the name of the tenancy, i.e. project_cookie.
    • [ ] Implement the ActsAsMiddleware contract, that when a Response is generated, will queue a cookie, if one isn't present, for the current tenant
    • [ ] Register routes with the appropriate middleware
    feat 
    opened by ollieread 0
An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality.

Support An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality. Ins

Ian Olson 3 Apr 14, 2021
Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications.

Laravel Boilerplate Project Laravel Boilerplate provides a very flexible and extensible way of building your custom Laravel applications. Table of Con

Labs64 848 Dec 28, 2022
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.

Nebula Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS. Nebula m

Nebula 228 Nov 11, 2022
Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Smeify is a Stable Automated Solution for Airtime and Data businesses in Nigeria, this package helps you integrate smeify easily into your laravel application.

Ogundiran Adewale Charles 2 Jul 27, 2022
LaravelFly is a safe solution to speeds up new or old Laravel 5.5+ projects, with preloading and coroutine, while without data pollution or memory leak

Would you like php 7.4 Preloading? Would you like php coroutine? Today you can use them with Laravel because of Swoole. With LaravalFly, Laravel will

null 456 Dec 21, 2022
Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5.

ENTRUST (Laravel 5 Package) Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5. If you are looking for the Laravel 4 ve

Zizaco 6.1k Dec 31, 2022
🔔 Flasher is a powerful and flexible flash notification system for PHP, Laravel, Symfony

A powerful and flexible flash notifications system for PHP, Laravel, Symfony ?? PHP Flasher helps you to add flash notifications to your PHP projects.

PHP Flasher 158 Jan 4, 2023
Laravel Setting - Easily save, update and get titles, descriptions, and more. it is very easy to use.

Laravel Setting Easily save, update and get titles, descriptions, and more. it is very easy to use. This is great for storing and receiving general si

Ali Ranjbar 2 Aug 23, 2022
Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).

Laravel-FCM Introduction Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud M

Rahul Thapa 2 Oct 16, 2022
Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

null 9 Dec 14, 2022
Jumpstart your web development journey with the HALT Stack Starter Kit, a one-command solution for creating dynamic, scalable, and clean web applications.

Welcome to the HALT Stack Starter Kit! This kit is designed to help you kickstart your web development projects using the HALT Stack, a powerful combi

HALT Stack 6 Jun 7, 2023
A modern solution for running Laravel Horizon with a CRON-based supervisor.

A modern solution for running Laravel Horizon with a cron-based supervisor This Laravel package automatically checks every three minutes if your Larav

Ralph J. Smit 31 Dec 9, 2022
Hcaptcha & Google ReCaptcha Solution for Laravel Framework

Laravel Captcha is a wrapper around HCaptcha & Google Recaptcha. It provides very easy-to-use Facade, Validation Rule, and blade directives.

Rahul Dey 47 Oct 27, 2022
Laravel 5 Repositories is used to abstract the data layer, making our application more flexible to maintain.

Laravel 5 Repositories is used to abstract the data layer, making our application more flexible to maintain.

Anderson Andrade 4k Jan 6, 2023
A simple drop-in solution for providing UUID support for the IDs of your Eloquent models.

Introduction A simple drop-in solution for providing UUID support for the IDs of your Eloquent models. Both v1 and v4 IDs are supported out of the box

GoldSpec Digital 501 Jan 4, 2023
This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT.

This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT. Two solutions are proposed, the first is a brute force approach while the other is an improved time complexity solution.

null 3 May 23, 2022
Open Source Invoicing Solution for Individuals & Businesses

Introduction Crater is an open-source web & mobile app that helps you track expenses, payments & create professional invoices & estimates. Web Applica

Crater Invoice 6.7k Jan 4, 2023
Simple solution for form request validation on lumen.

Form Request Validation for Lumen This small package contains a laravel-like solution for request form validation. Contents Form Request Validation fo

Samuel Nunes de Souza 5 Nov 4, 2022
Output complex, flexible, AJAX/RESTful data structures.

Fractal Fractal provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with J

The League of Extraordinary Packages 3.5k Dec 26, 2022