Download the PHP package alanshearer/envtenant without Composer

On this page you can find all versions of the php package alanshearer/envtenant. 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 envtenant

Laravel EnvTenant 2.3.*

Version 2.3.0 Changes:

Version 2.2.9 Changes:

Version 2.2.6 Changes:

Version 2.2.3 Changes:

Version 2.2.2 Changes:

The Laravel 5.2 EnvTenant package enables you to easily add multi-tenant capabilities to your application. This package is designed using a minimalist approach providing just the essentials - no views, routes, or configs. Just drop it in, run the migration, and start adding tenants. Your applications will have access to current tenant information through the dynamically set config('tenant') values. Optionally, you can let applications reconnect to the default master database so a tenant could manage all tenant other accounts for example. And, perhaps the best part, Artisan is completely multi-tenant aware! Just add the --tenant option to any command to run that command on one or all tenants. Works on migrations, queueing, etc.!

EnvTenant also offers a TenantContract, triggers Laravel events, and throws a TenantNotResolvedException, so you can easily add in custom functionality and tweak it for your needs.

Laravel EnvTenant was originally forked from the Laravel Tenantable project by @leemason Lee is to be credited with doing a lot of the hard work to figure out how to globally add the --tenant option to Artisan and for inspiration for the idea. Where this project differs is in it's approach to managing database connection settings. Tenantable stores settings in the database and offers unlimited domains. EnvTenant relies on your ENV and Database config and stores just the conneciton name in the table and only allows one subdomain and domain per tenant, which is most often plenty for most apps. EnvTenant also throws TenantNotResolvedException when tenants are not found, which you can catch.

Simple Installation & Usage

Composer install:

Then run composer dump-autoload.

Tenants database table install:

Service provider install:

Tenant creation (just uses a standard Eloquent model):

And you're done! Minimalist, simple. Whenever your app is visited via http://acme.domain.com or http://acmeinc.com the default database connection will be set to "db1", the table prefix will switch to "acme_", and config('tenant') will be set with tenant details allowing you to access values from your views or application.

Advanced EnvTenant Usage

Artisan

The --tenant option works on all Artisan commands.

Tenant

The class is a simple Eloquent model providing basic tenant settings.

TenantResolver

The class is responsible for resolving and managing the active tenant during Web and Artisan access. You can access the resolver class using .

If you want to use a custom model, register a custom service provider that binds a singleton to the TenantContract and resolves to an instance of your custom tenant model. EnvTenant will automatically defer to your custom model as long as you load your service provider before loading the EnvTenant\TenantServiceProvider.

Create this example service provider in your app/Providers folder as CustomTenantServiceProvider.php:

Then register in your config/app.php file.

Events

Throughout the lifecycle events are fired allowing you to listen and customize behavior.

Tenant activated:

Tenant resolved:

Tenant not resolved:

Tenant not resolved via the Web, an exception is thrown:

Securing sessions

Sessions in Laravel can be locked down to a domain, preventing users from jumping across domains and potentially retaining their authentication. Here's some quick example code that might be useful. I'm sure there are more sophisticated ways to manage this. In the future, I may also add some cross domain security to EnvTenant.

In your session config file, change the domain value to be something like this:

Enjoy! Report issues or ideas.


All versions of envtenant with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^5.2
vlucas/phpdotenv Version ^2.4
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 alanshearer/envtenant contains the following files

Loading the files please wait ....