承接 zakariayacine/laramediamover 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zakariayacine/laramediamover

Composer 安装命令:

composer require zakariayacine/laramediamover

包简介

LaraMediaMover is a versatile Laravel package that simplifies the movement and management of multimedia files of all types, including images, videos, and documents. It provides a comprehensive solution for uploading, storage, renaming, and handling files, ensuring a seamless development experience f

README 文档

README

lara-Media-Mover-logo

LaraMediaMover is a versatile Laravel package that simplifies the movement and management of multimedia files of all types, including images, videos, and documents. It provides a comprehensive solution for uploading, storage, renaming, and handling files, ensuring a seamless development experience for Laravel projects.

License Latest Version on Packagist Total Downloads

Installation

You can install this package via Composer by running the following command:

composer require zakariayacine/laramediamover

The package will automatically register itself.

Next, you should publish the package configuration file using the following command:

php artisan vendor:publish --tag=laramediamover-config

This will create a laramediamover.php configuration file in your config directory. You can customize the configuration according to your needs.

Usage

To use LaraMediaMover, you need to create an instance of the LaraMediaMover class and call the moveFile method. Here's an example of how to use it:

use Zakariayacine\LaraMediaMover\LaraMediaMover;

// Instantiate LaraMediaMover with the file content, extension, and optional parameters
$mediaMover = new LaraMediaMover($fileContent, 'jpg', 'my_image.jpg', 'public');

// Move the file and get its URL
$mediaUrl = $mediaMover->moveFile();

if ($mediaUrl) {
    // The file has been successfully moved, and $mediaUrl contains its URL
    // You can use $mediaUrl as needed in your application
} else {
    // An error occurred during the file move process
    // Handle the error appropriately
}

In the above example:

  • $fileContent is the content of the media file you want to move.
  • 'jpg' is the file extension.
  • 'my_image.jpg' is the desired file name.
  • 'public' is the storage disk you want to use.

You can customize these parameters according to your requirements.

Configuration

You can customize the package's behavior by modifying the laramediamover.php configuration file located in your config directory. This file allows you to define default settings for the package.

Exceptions

The package may throw a MediaMoveException in case of an error during the media move process. You can catch this exception to handle errors gracefully.

use Zakariayacine\LaraMediaMover\Exceptions\MediaMoveException;

try {
    // Attempt to move the media file here
} catch (MediaMoveException $e) {
    // Handle the error, log it, or return an error response
}

Example URLs with Hashed File Names

To illustrate how the LaraMediaMover package generates URLs with hashed file names, here are some examples using hashed names:

PDF Files

  • Original File Name: document.pdf
  • Hashed File Name: 4e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaffed001.pdf
  • Storage Path: PDF/4e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaffed001.pdf
  • Generated URL: https://example.com/storage/PDF/4e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaffed001.pdf

Images

  • Original File Name: picture.jpg
  • Hashed File Name: 7b5eaffed0014e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea.jpg
  • Storage Path: IMAGES/7b5eaffed0014e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea.jpg
  • Generated URL: https://example.com/storage/IMAGES/7b5eaffed0014e76275d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea.jpg

Videos

  • Original File Name: video.mp4
  • Hashed File Name: 5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea5d9d4b3b51.mp4
  • Storage Path: VIDEOS/5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea5d9d4b3b51.mp4
  • Generated URL: https://example.com/storage/VIDEOS/5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5ea5d9d4b3b51.mp4

Audio

  • Original File Name: audio.mp3
  • Hashed File Name: ea5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaudio.mp3
  • Storage Path: AUDIO/ea5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaudio.mp3
  • Generated URL: https://example.com/storage/AUDIO/ea5d9d4b3b51c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaudio.mp3

Other Files

  • Original File Name: other.docx
  • Hashed File Name: 1c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaother.docx
  • Storage Path: OTHER/1c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaother.docx
  • Generated URL: https://example.com/storage/OTHER/1c1ab9a44d5c0c15399d02889163361749e1645aa27b5eaaother.docx

These examples showcase how the LaraMediaMover package generates URLs with hashed file names for different types of media files based on their extensions and storage paths. The hashed file names provide security and uniqueness to each file.

License

This package is open-sourced software licensed under the MIT license.

Please customize this README to include specific instructions, details, or additional information related to your package. Replace the placeholder content with actual package details, usage instructions, and license information.

For more information and updates, visit the LaraMediaMover GitHub repository.

zakariayacine/laramediamover 适用场景与选型建议

zakariayacine/laramediamover 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「zakariayacine」 「laramediamover」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zakariayacine/laramediamover 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zakariayacine/laramediamover 我们能提供哪些服务?
定制开发 / 二次开发

基于 zakariayacine/laramediamover 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 33
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-02