minuteoflaravel/laravel-audio-video-validator
Composer 安装命令:
composer require minuteoflaravel/laravel-audio-video-validator
包简介
Laravel validator for video and audio files
README 文档
README
This package adds validators for audio and video files to your Laravel project.
Installation
To use this package you should intall ffmpeg multimedia framework:
- On Debian/Ubuntu, run
sudo apt install ffmpeg - On macOS with Homebrew:
brew install ffmpeg
After that install the package via composer:
composer require minuteoflaravel/laravel-audio-video-validator
Validators
Package adds these validators:
- audio
- video
- codec
- duration
- duration_max
- duration_min
- video_width
- video_height
- video_max_width
- video_max_height
- video_min_width
- video_min_height
Custom error messages
If you need to add your custom translatable error messages then just add them as always to resources/lang/en/validation.php file:
'audio' => 'The :attribute must be a audio.', 'video' => 'The :attribute must be a video.', 'codec' => 'The :attribute codec must be one of these: :codec', 'duration' => 'The :attribute must be :duration seconds duration.', 'duration_max' => 'The :attribute duration must be less than :duration_max seconds.', 'duration_min' => 'The :attribute duration must be greater than :duration_min seconds.', 'video_width' => 'The :attribute width must be :video_width.', 'video_height' => 'The :attribute height must be :video_height.', 'video_max_width' => 'The :attribute width must be less than :video_max_width.', 'video_min_width' => 'The :attribute width must be greater than :video_min_width.', 'video_min_height' => 'The :attribute height must be greater than :video_min_height.',
Some examples
To check if file is audio file and audio duration is 60 seconds:
$request->validate([ 'audio' => 'audio|duration:60', ]);
To check if file is audio file and audio duration is between 30 and 300 seconds:
$request->validate([ 'audio' => 'audio|duration_min:30|duration_max:300', ]);
To check if file is video file and video duration is between 30 and 300 seconds:
$request->validate([ 'video' => 'video|duration_min:30|duration_max:300', ]);
To check if file is video file and video dimensions are 1000x640:
$request->validate([ 'video' => 'video|video_width:1000|video_height:640', ]);
To check if file is video file and video dimensions greater than 1000x640:
$request->validate([ 'video' => 'video|video_min_width:1000|video_min_height:640', ]);
To check if file is audio file and codec is mp3 or pcm_s16le(wav):
$request->validate([ 'audio' => 'audio|codec:mp3,pcm_s16le', ]);
To check if file is video file and codec is h264(mp4):
$request->validate([ 'video' => 'video|codec:h264', ]);
License
The MIT License (MIT). Please see License File for more information.
minuteoflaravel/laravel-audio-video-validator 适用场景与选型建议
minuteoflaravel/laravel-audio-video-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 67.95k 次下载、GitHub Stars 达 97, 最近一次更新时间为 2022 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「media」 「ffmpeg」 「laravel」 「laravel-ffmpeg」 「minuteoflaravel」 「media-validator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 minuteoflaravel/laravel-audio-video-validator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 minuteoflaravel/laravel-audio-video-validator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 minuteoflaravel/laravel-audio-video-validator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Thumbnails for videos
Laravel Media Popup to upload/view the files
A simple but effective command-line tool for generating thumbnails of a video, and corresponding VTT file, for use within JW Player to allow for toolbar video preview.
Asset Manager Laravel package for Gigcodes UI Library
A Laravel Package Magnifier, a quick start for new laravel Packages
统计信息
- 总下载量: 67.95k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 97
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-02