From 0f58717ca09ba395b8b7613339041b2f1ae4acaa Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 23 Sep 2019 17:15:39 -0400 Subject: [PATCH 1/8] Update console-commands.blade.md --- docs/source/v2/console-commands.blade.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/v2/console-commands.blade.md b/docs/source/v2/console-commands.blade.md index b8ce69a..65dc67b 100644 --- a/docs/source/v2/console-commands.blade.md +++ b/docs/source/v2/console-commands.blade.md @@ -38,7 +38,7 @@ Similarly to [migrate](#migrate), these commands accept a `--tenants` option. ## Run {#run} -You can use the tenants:run command to run your own commands for tenants. +You can use the `tenants:run` command to run your own commands for tenants. If your command's signature were `email:send {--queue} {--subject=} {body}`, you would run this command like this: ``` @@ -61,4 +61,4 @@ You can delete specific tenants' cache by using the `--tags` option on `cache:cl php artisan cache:clear --tags=tenantdbe0b330-1a6e-11e9-b4c3-354da4b4f339 ``` -The tag is `config('tenancy.cache.tag_base') . $id`. \ No newline at end of file +The tag is derived from `config('tenancy.cache.tag_base') . $id`. From 1ee8f2b7fb91e1c2cf3614e95858a861288fc149 Mon Sep 17 00:00:00 2001 From: Jelle Witteveen Date: Mon, 7 Oct 2019 13:41:54 +0200 Subject: [PATCH 2/8] Update upgrading.blade.md Fixing broken links i've found while upgrading. --- docs/source/v2/upgrading.blade.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/v2/upgrading.blade.md b/docs/source/v2/upgrading.blade.md index 3e16407..48523be 100644 --- a/docs/source/v2/upgrading.blade.md +++ b/docs/source/v2/upgrading.blade.md @@ -52,5 +52,5 @@ If you're coming from 1.x, it's recommended to read (or at least skim through) t ## New Features - [Tenant Config]({{ $page->link('tenant-config') }}) -- [Migrate Fresh]({{ $page->link('commands#migrate-fresh') }}) -- [`tenants:create`]({{ $page->link('commands#create-tenant') }}) +- [Migrate Fresh]({{ $page->link('console-commands#migrate-fresh') }}) +- [`tenants:create`]({{ $page->link('console-commands#create-tenant') }}) From 8daf7885262b8031e57bf3e64dcf731758b55a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 7 Oct 2019 20:39:52 +0200 Subject: [PATCH 3/8] queue.failed central db --- docs/source/v2/jobs-queues.blade.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/v2/jobs-queues.blade.md b/docs/source/v2/jobs-queues.blade.md index 5b0121a..d2393cb 100644 --- a/docs/source/v2/jobs-queues.blade.md +++ b/docs/source/v2/jobs-queues.blade.md @@ -13,7 +13,7 @@ Jobs are automatically multi-tenant, which means that if a job is dispatched whi Open `config/queue.php` and make sure your queue driver has an explicitly set connection. Otherwise it would use the default one, which would cause issues, since `database.default` is changed by the package and Redis connections are prefixed. -**If you're using `database`, add a new line to `queue.connections.database`:** +**If you're using `database`, add a new line to `queue.connections.database` and `queue.failed`:** ```php 'connection' => 'mysql', ``` @@ -22,4 +22,4 @@ where `'mysql'` is the name of your non-tenant database connection with a `jobs` Also make sure you run the queue migrations **for the central database**, not your tenants. -**If you're using Redis, make sure its `'connection'` is not in `tenancy.redis.prefixed_connections`.** \ No newline at end of file +**If you're using Redis, make sure its `'connection'` is not in `tenancy.redis.prefixed_connections`.** From 8b71d5e74086516f7fa6d5c7410c91d8afaf238a Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 7 Oct 2019 15:24:11 -0400 Subject: [PATCH 4/8] Update configuration.blade.md --- docs/source/v2/configuration.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/v2/configuration.blade.md b/docs/source/v2/configuration.blade.md index e646082..79af871 100644 --- a/docs/source/v2/configuration.blade.md +++ b/docs/source/v2/configuration.blade.md @@ -30,7 +30,7 @@ Available storage drivers: #### redis {#redis-db-driver} -- `connection` - what Redis connection should be used to store tenant data +- `connection` - what Redis connection should be used to store tenant data. See the [Storage Drivers]({{ $page->link('storage-drivers') }}) documentation. ### `tenant_route_namespace` {#tenant-route-namespace} From 329ad760bd9b9c361567270192029c0c08af25e2 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 7 Oct 2019 15:33:34 -0400 Subject: [PATCH 5/8] Update storage-drivers.blade.md --- docs/source/v2/storage-drivers.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/v2/storage-drivers.blade.md b/docs/source/v2/storage-drivers.blade.md index dfd73d7..350111a 100644 --- a/docs/source/v2/storage-drivers.blade.md +++ b/docs/source/v2/storage-drivers.blade.md @@ -47,7 +47,7 @@ Read the [Redis documentation page on persistence](https://redis.io/topics/persi If your cache driver is Redis and you don't want to use AOF with it, run two Redis instances. Otherwise, just make sure you use a different database (number) for tenancy and another for anything else. -To use this driver, create a new Redis connection in the `database.redis` configuration (`config/database.php`) called `tenancy`. +To use this driver, create a new Redis connection in the `database.redis` configuration (`config/database.php`) called `tenancy` (or if you use another name, be sure to update it in the `tenancy.storage_drivers.redis.connection` configuration (`config/tenancy.php`). ```php 'tenancy' => [ From d2df532bd4060d091dc33f6fa5f0f17eae579260 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 7 Oct 2019 15:35:46 -0400 Subject: [PATCH 6/8] Update storage-drivers.blade.md --- docs/source/v2/storage-drivers.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/v2/storage-drivers.blade.md b/docs/source/v2/storage-drivers.blade.md index 350111a..76297fc 100644 --- a/docs/source/v2/storage-drivers.blade.md +++ b/docs/source/v2/storage-drivers.blade.md @@ -47,7 +47,7 @@ Read the [Redis documentation page on persistence](https://redis.io/topics/persi If your cache driver is Redis and you don't want to use AOF with it, run two Redis instances. Otherwise, just make sure you use a different database (number) for tenancy and another for anything else. -To use this driver, create a new Redis connection in the `database.redis` configuration (`config/database.php`) called `tenancy` (or if you use another name, be sure to update it in the `tenancy.storage_drivers.redis.connection` configuration (`config/tenancy.php`). +To use this driver, create a new Redis connection in the `database.redis` configuration (`config/database.php`) called `tenancy` (or if you use another name, be sure to update it in the `tenancy.storage_drivers.redis.connection` configuration (`config/tenancy.php`)). ```php 'tenancy' => [ From a7d47a98cf4ef4772f582d6cc1eeb7c22d6887af Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Mon, 7 Oct 2019 18:39:03 -0400 Subject: [PATCH 7/8] Update configuration.blade.md --- docs/source/v2/configuration.blade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/v2/configuration.blade.md b/docs/source/v2/configuration.blade.md index 79af871..d5e6911 100644 --- a/docs/source/v2/configuration.blade.md +++ b/docs/source/v2/configuration.blade.md @@ -48,7 +48,7 @@ You can set the suffix to `.sqlite` if you're using sqlite and want the files to ### `redis` {#redis} -If `tenancy.redis.tenancy` is set to true, connections listed in `tenancy.redis.prefixed_connections` will be prefixed with `config('tenancy.redis.prefix_base') . $id`. +If the `RedisTenancyBootstrapper` is enabled (see `bootstrappers` below), any connections listed in `tenancy.redis.prefixed_connections` will be prefixed with `config('tenancy.redis.prefix_base') . $id`. > Note: You need phpredis. Predis support will dropped by Laravel in version 7. From ea06a70a20f6956b1bcfd499e082ca04848317dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Thu, 10 Oct 2019 20:09:39 +0200 Subject: [PATCH 8/8] Landing page redesign (#25) * redesign * outline-none --- dist/index.html | 588 ++++++++++++++++++++++++++------------------- dist/spatie.png | Bin 0 -> 5169 bytes tailwind.config.js | 11 +- tailwind.css | 47 +--- 4 files changed, 353 insertions(+), 293 deletions(-) create mode 100644 dist/spatie.png diff --git a/dist/index.html b/dist/index.html index 3641941..27dac79 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3,280 +3,372 @@ + + - - + stancl/tenancy — Automatic multi-tenancy for your Laravel app. No code changes needed. - -
- +
+
+
+

Automatic tenancy for your Laravel app

+

No code changes required.

+

stancl/tenancy is a tenancy package that uses a completely new approach to multi-tenancy.

+

Instead of forcing you to change how you write your app, it bootstraps tenancy automatically, in the background.

+ +
+
+
+
+// Create a tenant
+$tenant = Tenant::new()
+    ->withDomains([
+        'tenant1.yourapp.com',
+        'tenant1.com',
+    ])->withPlan('free')
+    ->save();
 
-        
-
-
- -
-

Automatic multi-tenancy for your Laravel app.

-

You won't have to change a thing in your application's code.

-
- -
-
-
    -
  • No model traits to change database connection
  • -
  • No replacing of Laravel classes (Cache, Storage, ...) with tenancy-aware classes
  • -
  • Built-in tenant identification based on hostname (including second level domains)
  • -
-
-
- - -
+// Write your app like you're used to +Order::where('status', 'shipped')->get(); +Cache::get('order_count'); +asset('logo.png'); +dispatch(new SendOrderCreatedMail); +
-
-
- Star - - Laravel 5.8 - Latest Stable Version - Travis CI build - codecov +
+
+
+
+

Easy Installation

+

Two commands is all you need to get started.

+
+composer require stancl/tenancy
+php artisan tenancy:install
+
+

After installation, just focus on what's important to you — writing your app.

+
+ +
-
- -
-
-
-

Multi-tenancy is something that can be handled in the - background. Why should your app's code be polluted with tons of tenancy features - implementations? -

- -

stancl/tenancy is a Laravel package that implements multi-database - tenancy into your application in a way that doesn't require you to change anything in your existing - codebase. -

- -

How does it work?

-
-
    -
  1. The tenant is identified using the current hostname.
  2. -
  3. Database & Redis connections are switched, cache is tagged and filesystem root paths are suffixed.
  4. -
  5. Your code is automatically multi-tenant. No changes needed.
  6. -
-
-
- -
-
-

Easy Installation

-

Just install the package and move your tenant routes.

-
-
-
-$ composer require stancl/tenancy
-$ php artisan tenancy:install
-$ mv routes/web.php routes/tenant.php
-
-
- -
-
-
-cache()->remember('total_revenue', function () {
-   return Order::with('products')->get()->products->sum();
-});
-
-
-

Automatic Data Separation

-

Tenants' databases, Redis stores, filesystems and caches are automatically separated. You can write your app like you're used to and let the package worry about tenant data separation.

-
-
- -
-
-

Configurable

-

Even though everything happens automatically, you're still in control. You can configure how database names, Redis keys and filesystem paths are prefixed, as well as how cache is tagged and what DB/Redis connections and FS disks are made multi-tenant.

-
-
-
-'redis' => [
-  'tenancy' => true,
-  'prefix_base' => 'tenant',
-  'prefixed_connections' => [
-    'default',
-    'cache',
-  ],
-]
-
-
- -
-
-
-$ artisan tenants:seed --tenants=8075a580-1cb8-11e9-8822-49c5d8f8ff23
-Tenant: 8075a580-1cb8-11e9-8822-49c5d8f8ff23 (laravel.localhost)
-Database seeding completed successfully.
-
-
-

CLI-friendly

-

stancl/tenancy comes with artisan commands for - migrating, rolling back, as well as seeding tenant databases.

-
-
- -
-
-

SOLID Extensibility

-

The package follows the SOLID principles and is open to extension. You're free to write - (and contribute! ) - your own storage drivers and database managers. +

+
+
+

Automatic & Flexible

+

Multi-tenancy is something that can be handled in the background.

+

Why should your code be polluted with tons of tenancy-related things? +

+

Why have your code bound to a specific implementation? Handling things in the + background gives you the flexibility to change how tenancy works for your project without pain.

-
-
-class PostgreSQLDatabaseManager implements TenantDatabaseManager
-{
-  public function createDatabase($name)
-  {
-    //
-  }
-
+
- -
- -
-
-

Stay Updated

-

- If you'd like to be notified about new versions and related stuff, you can sign up for e-mail notificatons or join our Telegram - channel. -

- -
- -
-
-

Subscribe to e-mail notifications

-
- - +
+
+
+

Awesome Integration

+

By switching things in the background, the package doesn’t stand in your way. +

+

You can integrate with just about any package.

+
+ + + + + + + + + + + + + + + + + + + + Spatie
-
-

What would you like to be notified about?

-
    -
  • -
  • -
  • -
  • -
-
-
- - -
- - - +
+ - + class="text-indigo-800 font-bold text-xl w-64 text-center py-2 rounded-10 + border-indigo-200 border-2 focus:outline-none focus:border-indigo-600 + hover:border-indigo-600 border-transition">Integration + docs + +
+
+ -