Download the PHP package hassan/laravel-s3-browser-based-uploads without Composer
On this page you can find all versions of the php package hassan/laravel-s3-browser-based-uploads. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hassan/laravel-s3-browser-based-uploads
More information about hassan/laravel-s3-browser-based-uploads
Files in hassan/laravel-s3-browser-based-uploads
Package laravel-s3-browser-based-uploads
Short Description Upload files to AWS S3 Directly from Browser
License MIT
Homepage https://github.com/dhassanali/laravel-s3-browser-based-uploads
Informations about the package laravel-s3-browser-based-uploads
Laravel S3 Browser Based Uploads
Upload files to AWS S3 directly from the browser using presigned POST requests, reducing server load and bandwidth usage.
Requirements
- PHP 8.1 or higher
- Laravel 9.x, 10.x, or 11.x
- AWS S3 bucket with appropriate permissions
Installation
1. Install the package via composer
For Laravel 9+, you may need to install Flysystem dependencies:
2. Publish the config file
3. Configure your AWS credentials
Add your AWS settings to .env:
4. Configure S3 CORS (Required!)
For browser uploads to work, you must configure CORS on your S3 bucket. Add this CORS configuration in your AWS S3 Console:
Important: Replace https://yourdomain.com with your actual domain(s). For local development, you may add http://localhost:8000 or use ["*"] (not recommended for production).
Usage
Basic Usage
Example
Check out the demo with Filepond
Using Credentials Routes
You can optionally register a route that returns the credentials as JSON:
This creates an endpoint that returns:
Security Considerations
⚠️ Important Security Warnings
-
Filename Sanitization: Using
${filename}in your config can expose you to path traversal attacks. Consider: -
File Size Limits: Always set
content-length-rangein your config to prevent abuse: -
Content-Type Validation: Restrict file types using conditions:
-
Short Expiration Times: Use short-lived URLs (1-15 minutes recommended):
-
Rate Limiting: The credentials endpoint includes default rate limiting (60 requests/minute). Adjust as needed.
-
HTTPS Only: Always use HTTPS in production to prevent credential interception.
- Bucket Permissions: Set appropriate S3 bucket policies and ACLs. Avoid public write access.
AWS IAM Permissions
Your AWS IAM user needs these S3 permissions:
Known Limitations
- Does not work with AWS IAM Identity Center credentials (use standard IAM credentials)
- Maximum expiration time is capped at 12 hours for security
- Requires CORS configuration on S3 bucket
Security Disclosure
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
All versions of laravel-s3-browser-based-uploads with dependencies
aws/aws-sdk-php Version ^3.0
league/flysystem-aws-s3-v3 Version ^3.0
graham-campbell/manager Version ^4.7|^5.0
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/contracts Version ^9.0|^10.0|^11.0