Download the PHP package dhananjay-vaidya/s3-connector without Composer
On this page you can find all versions of the php package dhananjay-vaidya/s3-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dhananjay-vaidya/s3-connector
More information about dhananjay-vaidya/s3-connector
Files in dhananjay-vaidya/s3-connector
Package s3-connector
Short Description A lightweight Laravel service for easy integration with the S3 Connector API. Provides simple interface to interact with S3 storage through the S3 Connector API without direct AWS SDK integration.
License MIT
Homepage https://github.com/dhananjay-vaidya/s3-connector
Informations about the package s3-connector
S3 Connector
A lightweight Laravel package for easy integration with the S3 Connector API. This package provides a simple interface to interact with S3 storage through the S3 Connector API without the need for direct AWS SDK integration.
Features
- ๐ Simple Integration - Easy to add to any Laravel project via Composer
- ๐ API Key Authentication - Secure access using API keys
- ๐ Complete S3 Operations - Upload, download, delete, list, copy, and more
- ๐ Presigned URLs - Generate temporary access URLs for files
- ๐ Health Monitoring - Check API status and configuration
- ๐งน Cleanup Tools - Manage temporary files and storage
- ๐ Comprehensive Logging - Track all API requests and responses
- โก Configurable - Customize timeouts, logging, and other settings
Installation
Via Composer (Recommended)
Manual Installation
If you prefer manual installation:
Configuration
1. Publish Configuration (Optional)
2. Add Environment Variables
Add these to your .env file:
3. Service Provider (Auto-registered)
The package automatically registers the service provider. If you need manual registration, add this to config/app.php:
Usage
Using Dependency Injection
Using the Facade
Using the Service Container
Available Methods
File Operations
| Method | Description | Parameters |
|---|---|---|
upload() |
Upload a file to S3 | $file, $path, $metadata, $visibility |
download() |
Download a file from S3 | $key, $localPath |
delete() |
Delete a file from S3 | $key |
list() |
List files in S3 bucket | $prefix, $maxKeys |
metadata() |
Get file metadata | $key |
exists() |
Check if file exists | $key |
copy() |
Copy a file in S3 | $sourceKey, $destinationKey, $metadata |
presignedUrl() |
Generate presigned URL | $key, $expiresIn, $operation |
System Operations
| Method | Description | Parameters |
|---|---|---|
health() |
Check API health | None |
configCheck() |
Check S3 configuration | None |
bucketInfo() |
Get bucket information | None |
cleanupTemp() |
Clean up temporary files | None |
Utility Methods
| Method | Description | Parameters |
|---|---|---|
testConnection() |
Test API connection | None |
getServiceInfo() |
Get service information | None |
validateApiKey() |
Validate API key format | None |
Examples
Upload with Metadata
Download and Save Locally
Generate Presigned URL
List Files with Pagination
Health Check
Response Format
All methods return a consistent response format:
Example Error Handling
Testing
Run Tests
Test Configuration
The package includes PHPUnit configuration and test suite setup. Tests use Orchestra Testbench for Laravel package testing.
Logging
The service automatically logs all API requests and responses when logging is enabled:
Log entries include:
- Request method and URL
- Response status and size
- Error details (if any)
- File operation details
Troubleshooting
Common Issues
-
API Key Error
Solution: Add your API key to the
.envfile -
Connection Timeout
Solution: Increase timeout in configuration or check network connectivity
-
Authentication Failed
Solution: Verify your API key is correct and has proper permissions
-
File Not Found
Solution: Check the file key/path exists in your S3 bucket
Debug Mode
Enable detailed logging for debugging:
Security Considerations
- API Key Security: Keep your API key secure and never commit it to version control
- File Permissions: Use appropriate file visibility settings for your use case
- Input Validation: Always validate file inputs before uploading
- Rate Limiting: Be aware of API rate limits for your S3 Connector instance
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
Support
For issues and questions:
- Check the documentation
- Review the error logs
- Verify your configuration settings
- Test the connection using the
testConnection()method - Create an issue on GitHub
License
This package is open-sourced software licensed under the MIT license.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
Credits
- Dhananjay Vaidya - Initial work - dhananjay-vaidya
S3 Connector makes S3 storage integration simple, secure, and scalable for any Laravel project. ๐
All versions of s3-connector with dependencies
laravel/framework Version ^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.0