Download the PHP package wronx/multitenancy-bundle without Composer

On this page you can find all versions of the php package wronx/multitenancy-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package multitenancy-bundle

Poor Man's Symfony Multitenancy Bundle

This piece of poorly written code may help you with creating multi-tenant applications in Symfony. Or may not. I don't know, I'm a plumber, not a fortune-teller.

License:

Copyright © 2017 github.com/WRonX This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.

Features:

Just one: you can enable multi-tenant architecture in your application.

How it works

I couldn't think of better solution, so every tenant has a name and host, by which it's identified. Name is used to identify tenant when using Symfony console, host for everything else. In general, ConnectionWrapper changes Connection database, depending on currently used host.

NOTE: In performance matter, this is probably not the best idea for bigger applications and you probably should cache Connection somehow to prevent it from making tenant identifying SQL request every time it's created. But what do I know.

Installation and Configuration:

1. Installing the bundle

First, install the bundle with composer:

Then add the bundle to AppKernel:

And add the following do your config.yml:

If you skip the last step, multitenancy will be disabled by default.

NOTE: With disabled multitenancy, your application uses the main (described in parameters.yml) database in normal way.

The following steps are assuming multitenancy is enabled.

2. Prepare Tenant Manager database:

First, create database, which will serve as Tenant Manager. That means connection details will be stored there. Passwords will be stored in plaintext, just like DB password in parameters.yml. The parameters.yml connection details should point to Tenant Manager database. Now, Tenant Manager database should contain tenants table with connection details for every tenant:

As ConnectionWrapper uses REGEXP, host field can look like the following:

As you can see from this example, you can handle multime client domains, and subdomains can be ignored. Also, SELECT query is ordered by host field's length (descending), so every request to non-existing host (tenant) will be handled by connection data defined in record with .* host, which can be useful for creating demo environment. Many thanks to swiniak for coming up with REGEXP idea.

2. Using included code and configuration:

This should be self-explanatory.

3. Using Symfony console:

Just remember to add tenant name for every command, using --tenant=TENANTNAME (this is the name field from tenants table).

4. New console commands

Two new console commands were added:

Changes coming soon

Summary

Oh, come on, I spent enough time writing readme already...


All versions of multitenancy-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/symfony Version ~2.8|~3.0
doctrine/dbal Version ~2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wronx/multitenancy-bundle contains the following files

Loading the files please wait ....