Download the PHP package elamed123/laravel-temp-media without Composer
On this page you can find all versions of the php package elamed123/laravel-temp-media. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-temp-media
Laravel Temp Media
A comprehensive Laravel package for handling temporary media uploads with automatic cleanup and secure transfer to permanent models using Spatie Media Library.
โจ Features
- ๐ Temporary File Management - Upload and manage temporary media files with automatic expiration
- ๐ Secure Transfer System - Transfer temporary media to permanent models with validation
- ๐งน Automatic Cleanup - Built-in cleanup system for expired and processed files
- ๐ Session Security - Session-based ownership validation for enhanced security
- ๐ก Event System - Comprehensive event system for custom integrations
- ๐ฏ Type Safety - Full PHP 8.1+ type declarations and strict typing
- ๐ PSR Compliance - Adheres to PSR standards for clean, maintainable code
- ๐งช Comprehensive Testing - Full test suite with factories and examples
- โก Performance Optimized - Efficient database queries and background processing
๐ Requirements
- PHP 8.1, 8.2, or 8.3
- Laravel 8.0 or higher
- Spatie Media Library 10.0 or 11.0
๐ Quick Start
Installation
Publish Configuration and Migrations
Run Migrations
Configure Environment Variables
Add to your .env file:
๐ฏ Basic Usage
Upload Temporary Media
Using the API
Using the Service
Transfer to Permanent Model
Using the Trait
Using the Service
๐ API Reference
Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/temp-media |
Upload temporary media |
GET |
/api/v1/temp-media/{id} |
Get temporary media details |
DELETE |
/api/v1/temp-media/{id} |
Delete temporary media |
POST |
/api/v1/temp-media/validate |
Validate temporary media IDs |
Response Examples
Upload Response
Transfer Response
โ๏ธ Configuration
The package provides extensive configuration options:
๐งน Cleanup
Automatic Cleanup
The package automatically cleans up expired and processed media hourly. You can configure this in the config file.
Manual Cleanup
Programmatic Cleanup
๐ก Events
The package dispatches several events for custom integrations:
TempMediaUploaded
MediaTransferred
TempMediaExpired
๐งช Testing
Running Tests
Test Example
๐ง Advanced Features
Custom Media Properties
Order Management
Media Conversions
Enable thumbnail generation:
This generates:
thumb: 300x300 pixels with sharpeningsmall: 150x150 pixels
๐ Troubleshooting
Common Issues
File Upload Fails
- Check file size limits in configuration
- Verify MIME type is allowed
- Ensure file is valid (not corrupted)
- Check rate limiting settings
Transfer Fails
- Ensure temporary media IDs are valid and not expired
- Check that target model implements HasMedia interface
- Verify session ownership if session validation is enabled
Cleanup Not Working
- Check if auto cleanup is enabled
- Verify scheduler is running
- Run manual cleanup command
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This package is open-sourced software licensed under the MIT license.
๐จโ๐ป Author
Elabidi Mohammed
- Email: [email protected]
- GitHub: @elamed123
๐ Acknowledgments
- Spatie for the excellent Media Library package
- Laravel for the amazing framework
- All contributors who help improve this package
๐ Documentation
For complete documentation, please visit the Documentation file.
๐ Changelog
Please see CHANGELOG for more information on what has changed recently.
Made with โค๏ธ for the Laravel community