Download the PHP package karlmonson/tenant without Composer

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

Tenant

Tenant allows for storing configuration settings in the database. This package is perfect for multitenant applications.

Installation

Install via Composer:

Configuration

Register the Service Provider:

Then register the Facade:

Then run migrations to create the Tenant database table:

Usage

Seeding

To get started you may use the TenantTableSeeder provided by running the following command:

This will seed the Tenant table with the default 3rd party config variables found the in .env file.

Creating/Updating Keys

To store a new key/value in the Tenant table, you may use the set method on the Tenant Facade:

The set function will both store a new key/value pair as well as update an already existing pair.

If the encrypt flag is set to true, the value will be stored using the Laravel encrypt() method. When you retrieve the value from Tenant, it will automatically filter through the decrypt() method. It is recommended to always use the encrypt flag for Passwords, API Secrets, and any other sensitive information.

If the env flag is set to true, it will let Tenant know that it is a System/Package config option that should be used in place of setting the value in the .env file.

You may also use the Artisan command to set/update keys:

Retrieving Keys

To retrieve a key/value pair in the Tenant table, you may use the get method on the Tenant Facade:

The get method functions similarly to the Config::get() method by allowing you to pass a default value that will be returned if the value of the key is null or if the key does not exist.

You may also use the Artisan command to get keys, practical for testing/debugging purposes:

Or you may also list all the keys in the Tenant table with the following command:

Using the Stored Config Values

This is probably the most important part of Tenant, and certainly the most magical.

When using Tenant for 3rd party services, you may use the values by calling the swapConfig method on the Tenant Facade:

The swapConfig method will load the stored values into their respective configs for the current request. They are not permanently added to the configs making it still possible to use the values from the .env file if you so desire.

In order for the key/values stored in Tenant to be swapped successfully, the must follow the same structure as listed in the .env file. (i.e. MAIL_DRIVER or REDIS_HOST)

Contributing

Thank you for being willing to contribute to Tenant. You can read the contribution guidelines here.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of tenant with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
illuminate/database Version ^5.3 || ^5.7 || ^5.8 || ^6.0
illuminate/support Version ^5.3 || ^5.7 || ^5.8 || ^6.0
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 karlmonson/tenant contains the following files

Loading the files please wait ....