larareko/aws-rekognition
Composer 安装命令:
composer require larareko/aws-rekognition
包简介
A Laravel package for the AWS Rekognition
README 文档
README
A Laravel package/facade for the Rekognition API PHP SDK.
This repository implements a simple Service Provider of the AWS Rekognition client, and makes it easily accessible via a Facade in Laravel >= 5.
See AWS Rekognition for more information.
Requirements
Create an account at AWS and take note of your API keys.
Installation using Composer
In your terminal application move to the root directory of your laravel project using the cd command and require the project as a dependency using composer.
composer require larareko/aws-rekognition
This will add the following lines to your composer.json and download the project and its dependencies to your projects ./vendor directory:
// ./composer.json { "name": "larareko/larareko-demo", "description": "A dummy project used to test the Laravel Larareko (AWS Rekognition) Facade.", // ... "require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", "larareko/aws-rekognition": "0.1*", // ... }, //... }
Usage
In order to use the static interface we must customize the application configuration to tell the system where it can find the new service. Open the file config/app.php and add the following lines ([a], [b]):
// config/app.php return [ // ... 'providers' => [ // ... /* * Package Service Providers... */ Larareko\Rekognition\RekognitionServiceProvider::class, // [a] /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ], // ... 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, // ... 'Rekognition' => 'Larareko\Rekognition\RekognitionFacade', // [b] 'Hash' => Illuminate\Support\Facades\Hash::class, // ... ], ];
Publish Vendor
aws-rekognition requires a connection configuration. To get started, you'll need to publish all vendor assets running:
php artisan vendor:publish
This will create a config/rekognition.php file in your app that you can modify to set your configuration. Make sure you check for changes compared to the original config file after an upgrade.
Now you should be able to use the facade within your application. Ex:
class LabelDetectionImage extends Model { /** * Upload image to S3 * * @param Illuminate\Http\UploadedFile $file * * @return string */ public function upload(UploadedFile $file) : string { $name = time() . $file->getClientOriginalName(); \Rekognition::uploadImageToS3(file_get_contents($file), null, self::BUCKET, $name); return $name; } }
Testing
Unit Tests are created with PHPunit and orchestra/testbench, they can be ran with ./vendor/bin/phpunit.
Contributing
Find an area you can help with and do it. Open source is about collaboration and open participation. Try to make your code look like what already exists or better and submit a pull request. Also, if you have any ideas on how to make the code better or on improving the scope and functionality please contact any of the contributors.
License
MIT License.
larareko/aws-rekognition 适用场景与选型建议
larareko/aws-rekognition 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.46k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2017 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 larareko/aws-rekognition 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 larareko/aws-rekognition 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-26