mrfrkayvaz/impono
Composer 安装命令:
composer require mrfrkayvaz/impono
包简介
A flexible Laravel package that handles uploads from links, raw data, or files, turning them into a unified upload process.
README 文档
README
A flexible Laravel package that handles uploads from links, raw data, or files, turning them into a unified upload process. Impono provides powerful image manipulation, compression, and storage capabilities with an intuitive API.
Features
- 🔗 Multiple Upload Sources: Upload from files, URLs, or raw data (base64)
- 🖼️ Image Manipulation: Resize, convert, apply filters, and more
- 🗜️ Smart Compression: Automatic image optimization
- 🎨 Built-in Filters: Sepia, blur, brightness adjustments
- 💾 Flexible Storage: Support for multiple Laravel storage disks
- 🔧 Extensible: Easy to add custom manipulation drivers
- 🧪 Well Tested: Comprehensive test suite with Pest PHP
- ⚡ Performance: Optimized for speed and memory efficiency
Installation
You can install the package via Composer:
composer require mrfrkayvaz/impono
Laravel Auto-Discovery
The package will automatically register itself with Laravel 5.5+.
Manual Registration
If you're using an older version of Laravel, add the service provider to your config/app.php:
'providers' => [ // ... Impono\ImponoServiceProvider::class, ],
And add the facade alias:
'aliases' => [ // ... 'Impono' => Impono\Facades\Impono::class, ],
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Impono\ImponoServiceProvider" --tag="impono-config"
Environment Variables
Add these variables to your .env file:
FILESYSTEM_DISK=local IMPOONO_TEMP_PATH=impono/tmp IMPOONO_LOCATION=uploads
Usage
Basic Upload from File
use Impono\Facades\Impono; use Illuminate\Http\Request; public function upload(Request $request) { $file = $request->file('image'); $result = Impono::fromFile($file) ->disk('local') ->location('uploads/2025/jan') ->push('my-image.png'); echo $result->getURL(); // uploads/2025/jan/my-image.png }
Upload from URL
use Impono\Facades\Impono; $result = Impono::fromUrl('https://example.com/image.jpg') ->resize(800, 600) ->quality(85) ->convert(Extension::WEBP) ->compress() ->push('optimized-image.webp'); echo $result->getURL();
Upload from Base64 Data
use Impono\Facades\Impono; $base64Data = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...'; $result = Impono::fromData($base64Data) ->resize(400, 300) ->sepia() ->push('vintage-photo.png');
Image Manipulation
use Impono\Facades\Impono; use Impono\Enums\Extension; $result = Impono::fromFile($file) ->resize(1200, 800) // Resize to specific dimensions ->quality(90) // Set JPEG quality ->convert(Extension::WEBP) // Convert to WebP format ->sepia() // Apply sepia filter ->blur(5) // Apply blur effect ->brightness(20) // Adjust brightness ->compress() // Optimize file size ->disk('s3') // Store on S3 ->location('images/gallery') // Custom storage path ->push('processed-image.webp');
Available Image Operations
Resizing
->resize(800, 600) // Resize to exact dimensions ->width(800) // Set width only ->height(600) // Set height only
Format Conversion
use Impono\Enums\Extension; ->convert(Extension::WEBP) // Convert to WebP ->convert(Extension::PNG) // Convert to PNG ->convert(Extension::JPEG) // Convert to JPEG ->convert(Extension::GIF) // Convert to GIF ->convert(Extension::AVIF) // Convert to AVIF ->convert(Extension::HEIC) // Convert to HEIC ->convert(Extension::TIFF) // Convert to TIFF
Filters and Effects
->sepia() // Apply sepia filter ->blur(5) // Apply blur (1-100) ->brightness(20) // Adjust brightness (-100 to 100) ->quality(85) // Set JPEG quality (1-100)
Compression
->compress() // Optimize file size
Storage Configuration
// Use different storage disks ->disk('local') // Local storage ->disk('s3') // Amazon S3 ->disk('gcs') // Google Cloud Storage // Set custom storage location ->location('uploads/2025/jan') ->location('images/products')
File Information
$result = Impono::fromFile($file)->push(); // Get file information echo $result->getURL(); // File path echo $result->getFilename(); // Filename without extension echo $result->getExtension(); // File extension echo $result->getDisk(); // Storage disk echo $result->getLocation(); // Storage location echo $result->getIsTemp(); // Is temporary file // Get image dimensions (for images) $width = $result->getWidth(); $height = $result->getHeight(); $fileSize = $result->getFileSize();
Configuration Options
Basic Configuration
// config/impono.php return [ 'temp_path' => 'impono/tmp', // Temporary file storage path 'location' => 'uploads', // Default storage location 'mimes' => [ // Supported file types ['extension' => 'jpg', 'type' => 'image', 'mime' => 'image/jpeg'], ['extension' => 'png', 'type' => 'image', 'mime' => 'image/png'], ['extension' => 'gif', 'type' => 'image', 'mime' => 'image/gif'], ['extension' => 'webp', 'type' => 'image', 'mime' => 'image/webp'], // ... more file types ] ];
Supported File Types
The package supports a wide range of file types:
Images:
- JPEG, PNG, GIF, WebP, AVIF, HEIC, TIFF, BMP, SVG
Videos:
- MP4, WebM
Documents:
- PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, CSV
Audio:
- MP3, WebA
Archives:
- ZIP, RAR
Other:
- TXT, XML
Advanced Usage
Custom Storage Paths
$result = Impono::fromFile($file) ->disk('s3') ->location('user-uploads/' . auth()->id() . '/profile') ->push('avatar.jpg');
Batch Processing
$files = $request->file('images'); $results = []; foreach ($files as $file) { $results[] = Impono::fromFile($file) ->resize(800, 600) ->compress() ->push(); }
Error Handling
try { $result = Impono::fromUrl('https://example.com/image.jpg') ->resize(800, 600) ->push(); } catch (\InvalidArgumentException $e) { // Handle unsupported file type return response()->json(['error' => 'Unsupported file type'], 400); } catch (\RuntimeException $e) { // Handle download/processing errors return response()->json(['error' => 'Failed to process image'], 500); }
Testing
The package includes a comprehensive test suite. Run tests using:
composer test
Requirements
- PHP 8.2+
- Laravel 12.0+
- GD or Imagick extension
- Spatie Image package
Dependencies
illuminate/support^12.0illuminate/database^12.0illuminate/http^12.0spatie/image^3.8spatie/image-optimizer^1.8
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- 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.
Support
If you find this package useful, please consider starring it on GitHub. For issues and feature requests, please use the GitHub issue tracker.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Roadmap
- Video manipulation support
- PDF processing capabilities
- Advanced compression algorithms
- CDN integration
- Batch processing queue support
- Watermark functionality
Made with ❤️ for the Laravel community
mrfrkayvaz/impono 适用场景与选型建议
mrfrkayvaz/impono 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 33 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「upload」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrfrkayvaz/impono 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrfrkayvaz/impono 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrfrkayvaz/impono 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Laravel Media Popup to upload/view the files
Alfabank REST API integration
Upload behavior for Yii 2
Yii-Framework widget for uploading and cropping images
An image upload package which provides lot of functions such as upload, resize, crop, rotate, delete.
统计信息
- 总下载量: 33
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-06