Download the PHP package nandung/s3-manager without Composer
On this page you can find all versions of the php package nandung/s3-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nandung/s3-manager
More information about nandung/s3-manager
Files in nandung/s3-manager
Package s3-manager
Short Description Laravel package for managing multiple S3-compatible storage buckets with quota management, URL embedding, and synchronization
License MIT
Homepage https://github.com/nandung-id/s3-manager
Informations about the package s3-manager
Laravel S3 Manager
A powerful Laravel package for managing multiple S3-compatible storage buckets with quota management, URL embedding, file synchronization, and comprehensive file tracking.
Features
- 🪣 Multi-Bucket Support - Manage multiple S3-compatible storage providers (AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces, etc.)
- 📊 Quota Management - Set storage limits per bucket and globally with automatic enforcement
- 🔗 URL Generation - Generate public URLs, presigned URLs, and embed proxy URLs
- 🔄 Synchronization - Sync remote bucket contents with local database for fast queries
- 📁 File Tracking - Track all uploaded files with metadata in your database
- 🚀 Fluent API - Clean, chainable interface for all operations
- 🎭 Facade Support - Use the convenient
S3Managerfacade - ⚡ Queue Support - Background sync jobs for large buckets
Requirements
- PHP 8.2 or higher
- Laravel 10.x to 12.x
- AWS SDK for PHP 3.x
Installation
Install the package via Composer:
Publish the configuration file:
Run the migrations:
Or publish migrations first if you want to customize them:
Configuration
After publishing, configure your buckets in config/s3-manager.php:
Environment Variables
Add these to your .env file:
Usage
Basic Usage with Facade
Fluent Bucket API
URL Generation
Quota Management
Quota exceptions are thrown automatically when limits are exceeded:
Synchronization
Sync remote bucket contents with your local database:
Dependency Injection
Multiple Bucket Configuration
AWS S3
Cloudflare R2
MinIO (Self-hosted)
DigitalOcean Spaces
Embed Proxy
The embed proxy allows you to serve files through your application, useful for:
- Hiding actual S3 URLs
- Adding authentication/authorization
- Caching headers control
- Analytics tracking
Configuration
Usage
The embed route automatically handles:
- Content-Type headers
- Cache-Control headers
- ETag headers
- Last-Modified headers
Database Schema
The package creates two tables:
s3_manager_files
Tracks all files across buckets:
| Column | Type | Description |
|---|---|---|
| id | bigint | Primary key |
| bucket_id | string(64) | Bucket identifier |
| path | string(1024) | File path in bucket |
| size | bigint | File size in bytes |
| mime_type | string(128) | MIME type |
| etag | string(64) | S3 ETag |
| last_modified | timestamp | Last modification time |
| metadata | json | Custom metadata |
| created_at | timestamp | Record creation time |
| updated_at | timestamp | Record update time |
s3_manager_bucket_usage
Tracks usage statistics per bucket:
| Column | Type | Description |
|---|---|---|
| id | bigint | Primary key |
| bucket_id | string(64) | Bucket identifier |
| total_size | bigint | Total storage used |
| file_count | bigint | Number of files |
| last_synced_at | timestamp | Last sync time |
| created_at | timestamp | Record creation time |
| updated_at | timestamp | Record update time |
Exception Handling
The package provides specific exceptions for different error scenarios:
API Reference
S3Manager Methods
| Method | Description |
|---|---|
bucket(string $bucketId) |
Get fluent bucket interface |
upload(string $bucketId, string $path, mixed $contents, array $options = []) |
Upload a file |
download(string $bucketId, string $path) |
Download a file |
delete(string $bucketId, string $path) |
Delete a file |
exists(string $bucketId, string $path) |
Check if file exists |
list(string $bucketId, string $prefix = '', bool $recursive = false) |
List files |
publicUrl(string $bucketId, string $path) |
Generate public URL |
presignedUrl(string $bucketId, string $path, ?int $expiration = null, string $method = 'GET') |
Generate presigned URL |
embedUrl(string $bucketId, string $path) |
Generate embed proxy URL |
sync(string $bucketId) |
Sync bucket with database |
getUsage(?string $bucketId = null) |
Get usage statistics |
FileRecord Model
UsageInfo Object
SyncResult Object
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover a security vulnerability, please send an email to [email protected]. All security vulnerabilities will be promptly addressed.
Credits
- Nandung
- All Contributors
License
The MIT License (MIT). Please see License File for more information.