Download the PHP package lanos/vapor-tenant-buckets-new without Composer
On this page you can find all versions of the php package lanos/vapor-tenant-buckets-new. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lanos/vapor-tenant-buckets-new
More information about lanos/vapor-tenant-buckets-new
Files in lanos/vapor-tenant-buckets-new
Package vapor-tenant-buckets-new
Short Description Automatically Provision AWS S3 Buckets for tenants.
License MIT
Homepage https://github.com/syn6UK/tenant-buckets-vapor
Informations about the package vapor-tenant-buckets-new
Automatically Provision AWS S3 Buckets for each tenant. It's an Extension for stancl/tenancy. For more details refer to TenancyForLaravel.
Credits
This is a modified version of the vidwanco/tenant-buckets package, changed to run on Laravel Vapor. A simple fix applied for correctly inject the AWS credentials in-line with Vapor requirements.
Also, for larger files, Vapor must utilise presigned URLs and frontloading the files via the frontend, so a change has been made to enable the correct CORS policy on each bucket as it is created.
Concept
The concept is simple. It is to automatically provison a new AWS S3 bucket for tenant on registration and update the same on the central database's tenant table & data coloumn under tenant_bucket
.
Then using a bootstrapper updating the bucket in config filesystems.disks.s3.bucket
during runtime when in Tenant's context and then reverting it back on central context.
Roadmap
This repo may be discontinued if the changes provided are merged into the original package, at which point we recommend using the original package.
Note: I have still not tested this package under production environment or with a real AWS S3 Bucket. I have only tested it under development environment using MinIO. I will update this after testing it on AWS S3 Bucket with an additional section on AWS IAM Policy Setup for creating the buckets using
aws-sdk-php
. Untill then, if you have tested, a PR is welcome.
Installation
You can install the package via composer:
Usage
1. Filesystem Config Setup
Ensure your S3 configuration has all the Key/Value pairs, as below:
File: config/filesystems.php
Using Minio for development? Make sure to update your
.env
withAWS_USE_PATH_STYLE_ENDPOINT=true
2. Tenancy Config
There are two parts in tenancy config to take care of.
Part a.
Add the TenantBucketBootstrapper::class
to the tenancy config file under bootstrappers
.
File: config/tenancy.php
Part b.
Make sure the s3
is commented in tenancy.filesystem.disks
config.
File: config/tenancy.php
3. Job Pipeline
Add Vidwan\TenantBuckets\Jobs\CreateTenantBucket
in JobPipeline::make()
File: app/Providers/TenancyServiceProviders.php
Cheers! 🥳
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Shashwat Mishra
- All Contributors
License
The MIT License (MIT). Please see License File for more information.