PHPackages                             msucevan/vapor-tenant-buckets-new - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. msucevan/vapor-tenant-buckets-new

AbandonedArchivedLibrary[File &amp; Storage](/categories/file-storage)

msucevan/vapor-tenant-buckets-new
=================================

Automatically Provision AWS S3 Buckets for tenants.

03.4k↓50%PHP

Since May 1Pushed 2y agoCompare

[ Source](https://github.com/msucevan/tenant-buckets-vapor)[ Packagist](https://packagist.org/packages/msucevan/vapor-tenant-buckets-new)[ RSS](/packages/msucevan-vapor-tenant-buckets-new/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Automatically Provision AWS S3 Buckets for each tenant. It's an Extension for [stancl/tenancy](https://github.com/stancl/tenancy). For more details refer to [TenancyForLaravel](https://tenancyforlaravel.com/).

Credits
-------

[](#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
-------

[](#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 &amp; 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

[](#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](https://min.io/). 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
------------

[](#installation)

You can install the package via composer:

```
composer require msucevan/vapor-tenant-buckets
```

Usage
-----

[](#usage)

### 1. Filesystem Config Setup

[](#1-filesystem-config-setup)

Ensure your S3 configuration has all the Key/Value pairs, as below:

**File:** `config/filesystems.php`

```
        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
        ],
```

> Using Minio for development? Make sure to update your `.env` with `AWS_USE_PATH_STYLE_ENDPOINT=true`

### 2. Tenancy Config

[](#2-tenancy-config)

There are two parts in tenancy config to take care of.

#### Part **a**.

[](#part-a)

Add the `TenantBucketBootstrapper::class` to the tenancy config file under `bootstrappers`.

```
Vidwan\TenantBuckets\Bootstrappers\TenantBucketBootstrapper::class
```

**File:** `config/tenancy.php`

```
    'bootstrappers' => [
        // Tenancy Bootstrappers
        Vidwan\TenantBuckets\Bootstrappers\TenantBucketBootstrapper::class,
    ],
```

#### Part **b**.

[](#part-b)

Make sure the `s3` is commented in `tenancy.filesystem.disks` config.

**File:** `config/tenancy.php`

```
    'filesystem' => [
        'suffix_base' => 'tenant',
        'disks' => [
            'local',
            'public',
            // 's3', // Make sure this stays commented
        ],
    ],
```

### 3. Job Pipeline

[](#3-job-pipeline)

Add `Vidwan\TenantBuckets\Jobs\CreateTenantBucket` in `JobPipeline::make()`

**File:** `app/Providers/TenancyServiceProviders.php`

```
use Vidwan\TenantBuckets\Jobs\CreateTenantBucket;

...

    public function events()
    {
        return [
            // Tenant events
            ...
            Events\TenantCreated::class => [
                JobPipeline::make([
                    Jobs\CreateDatabase::class,
                    Jobs\MigrateDatabase::class,
                    Jobs\SeedDatabase::class,
                    // Your own jobs to prepare the tenant.
                    // Provision API keys, create S3 buckets, anything you want!
                    CreateTenantBucket::class, // send(function (Events\TenantCreated $event) {
                    return $event->tenant;
                })->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
            ],
            ...
            Events\DeletingTenant::class => [
                JobPipeline::make([
                    DeleteTenantBucket::class, // send(function (Events\DeletingTenant $event) {
                    return $event->tenant;
                })->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
            ],
        ];
    }
```

Cheers! 🥳

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits-1)

- [Shashwat Mishra](https://github.com/secrethash)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd3e3178be222cf80471b98f824c7918530bf1a629d90faff40ffa1f11466f20?d=identicon)[msucevan](/maintainers/msucevan)

---

Top Contributors

[![secrethash](https://avatars.githubusercontent.com/u/11258035?v=4)](https://github.com/secrethash "secrethash (26 commits)")[![synergy6](https://avatars.githubusercontent.com/u/38252511?v=4)](https://github.com/synergy6 "synergy6 (19 commits)")[![msucevan](https://avatars.githubusercontent.com/u/57497646?v=4)](https://github.com/msucevan "msucevan (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![l4nos](https://avatars.githubusercontent.com/u/31861108?v=4)](https://github.com/l4nos "l4nos (3 commits)")

### Embed Badge

![Health badge](/badges/msucevan-vapor-tenant-buckets-new/health.svg)

```
[![Health](https://phpackages.com/badges/msucevan-vapor-tenant-buckets-new/health.svg)](https://phpackages.com/packages/msucevan-vapor-tenant-buckets-new)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
