a progress update about the hyn multi tenancy packages
No Images? Click here
   
 

laraflock/multi-tenant

 

An update unlike any of the previous. Let's talk about how you could and would like to use the package.

 
 

Examples

The examples below assume you have correctly set up the laraflock/multi-tenant package. The easiest way to use the package is using "composer require laraflock/multi-tenant" on a (preferably clean) laravel 5.1 installation and then registering the "HynMe\Framework\FrameworkServiceProvider" in your config/app.php.

Read the documentation for more details.

 
 

Creating websites

A website does not need any hostnames (domains) attached for it to be created. The only required attribute is a unique identifier and a tenant.

 
 

$someSite = \App::make('Laraflock\MultiTenant\Contracts\WebsiteRepositoryContract')->create([ 'identifier'=> 'some-site', 'tenant_id' => 1 ]);

In the above example you would create a website for the first tenant, probably yourself, with the identifier "some-site".

 
 

Creating hostnames

A hostname only needs a hostname (tada) and tenant and can be attached to or detached from a website.

You are free to add hostnames to any tenant you like, In the future we can use these to have domains owned by one tenant used in websites owned by another tenant.

 
 

$someHostname = \App::make('Laraflock\MultiTenant\Contracts\HostnameRepositoryContract')->create([ 'hostname'=> 'some-hostname.org', 'website_id' => $someSite->id, 'tenant_id => 1 ]);

Using the previous example we would now be able to add the hostname "some-hostname.org" to the previously created website of tenant 1.

 
 

Result

The above two code examples show you how easy it is to create websites and hostnames. The model event observers will handle everything by writing webserver configurations and connecting them to hostnames, websites and tenants.

 
 

Tips

 
 

Your opinion counts

 
 

Share your thoughts

I'd like to know how you would use this package. And what requirements you have in order to create production websites with it.

You can reply on this e-mail or talk to me at the larachat slack.

 
 

Future

 
 

Document, implement and support.

The coming period I will mainly focus on documenting the available features of the package. Additionally more effort will be made to create integration tests and adding showcases. This will also require me to extend the current hyn and probably laraflock websites.

 
 

Closure

The multi tenancy package is awaiting your implementation. If you need assistance let me know. I'm all ears about your opinion and any feedback is welcome.

  • See the trello todo for the current backlog.
  • If you have any suggestions based on this newsletter, the package, laraflock or anything else, please let me know.
  • Contact me via a reply to this e-mail newsletter or on the laravel community slack.