wkasunsampath/laravel-vuforia
Composer 安装命令:
composer require wkasunsampath/laravel-vuforia
包简介
Vuforia web service API for Laravel
README 文档
README
Vuforia web service API for Laravel 8 & Laravel 9. This package is an improvement of panoscape/laravel-vuforia package. All the credits should go to the original developer.
Install
composer require wkasunsampath/laravel-vuforia
Features
With automatic package discovery, you do not have to add any providers or aliases.
Easy with Facade:
- VWS::getTargets()
- VWS::getTarget(string $id)
- VWS::updateTarget(string $id, mixed $target)
- VWS::addTarget(mixed $target)
- VWS::deleteTarget(string $id)
- VWS::getDuplicates(string $id)
- VWS::getDatabaseSummary()
- VWS::getTargetSummary(string $id)
Call with array
VWS::addTarget([ 'name' => 'my_new_target', 'width' => 320, 'path' => public_path('storage/IMG_2738.jpg') ]);
Pre-Check
VWS::addTarget(['name' => '123 1']);
Exception with message 'Invalid naming'
VWS::addTarget(['name' => '123']);
Exception with message 'Target width is required'
VWS::addTarget(['name' => '1231', 'width' => 100, 'path' => public_path('storage/image.png')]);
Exception with message 'Image is too large'
Image Target Class
$target = new \WKasunSampath\LaravelVuforia\Target; $target->name = 'image_01'; $target->width = 320; $target->image = file_get_contents(public_path('images/001.jpg')); //optional fields $target->metadata = 'Hello world'; $target->active = false;
Wrapped result
[
"status" => 201,
"body" => '{"result_code":"TargetCreated","transaction_id":"xxx","target_id":"xxx"}',
]
[
"status" => 422,
"body" => '{"result_code":"BadImage","transaction_id":"xxx"}',
]
Configurable
You can publish the config file to config dir using the following command.
php artisan vendor:publish --tag=laravel_vuforia
This command will geneate laravel_vuforia.php file in config dir. It will look like below,
[
/*
|--------------------------------------------------------------
| Vuforia Web Service URLs
|--------------------------------------------------------------
|
|
*/
'url' => [
/*
|--------------------------------------------------------------
| Vuforia Web Service Targets Request URL
|--------------------------------------------------------------
|
|
*/
'targets' => 'https://vws.vuforia.com/targets',
/*
|--------------------------------------------------------------
| Vuforia Web Service Duplicates Request URL
|--------------------------------------------------------------
|
|
*/
'duplicates' => 'https://vws.vuforia.com/duplicates',
/*
|--------------------------------------------------------------
| Vuforia Web Service Summary Request URL
|--------------------------------------------------------------
|
|
*/
'summary' => 'https://vws.vuforia.com/summary',
],
/*
|--------------------------------------------------------------
| Vuforia cloud database credentials
|--------------------------------------------------------------
|
|
*/
'credentials' => [
/*
|--------------------------------------------------------------
| Vuforia cloud database access key
|--------------------------------------------------------------
|
|
*/
"access_key" => env('VUFORIA_ACCESS_KEY'),
/*
|--------------------------------------------------------------
| Vuforia cloud database secret key
|--------------------------------------------------------------
|
|
*/
"secret_key" => env('VUFORIA_SECRET_KEY'),
],
/*
|--------------------------------------------------------------
| Max image size(unencoded) in Byte. Default is 2MB
| Set to null to bypass size checking(not recommended)
|--------------------------------------------------------------
|
|
*/
'max_image_size' => 2097152,
/*
|--------------------------------------------------------------
| Max metadata size(unencoded) in Byte. Default is 2MB
| Set to null to bypass size checking(not recommended)
|--------------------------------------------------------------
|
|
*/
'max_meta_size' => 2097152,
/*
|--------------------------------------------------------------
| Name checking rule. Default is
| no spaces and may only contain:
| numbers (0-9), letters (a-z), underscores ( _ ) and dashes ( - )
| Set to null to bypass name checking(not recommended)
|--------------------------------------------------------------
|
|
*/
'naming_rule' => '/^[\w\-]+$/'
]
Jobs and Notification
/** * Upload image to Vuforia */ abstract class VuforiaJob implements ShouldQueue { use InteractsWithQueue, Queueable, SerializesModels; /** * Execute the job. * * @param VuforiaWebService $vws * @return void */ abstract function handle(VuforiaWebService $vws); /** * The job failed to process. * * @param Exception $exception * @return void */ abstract function failed(Exception $exception); }
abstract class VuforiaNotification extends Notification { use Queueable; protected $result; /** * Create a new notification instance. * * @param mixed $result * * @return void */ public function __construct($result) { $this->result = $result; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['database']; } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ 'result' => $this->result ]; } }
wkasunsampath/laravel-vuforia 适用场景与选型建议
wkasunsampath/laravel-vuforia 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 304 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 05 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「ar」 「vuforia」 「augmented-reality」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wkasunsampath/laravel-vuforia 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wkasunsampath/laravel-vuforia 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wkasunsampath/laravel-vuforia 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Vuforia web service api for laravel
Adds a custom image data object type that will be persisted to Vuforia
Vuforia web service api for laravel
Alfabank REST API integration
Vuforia web services api wrapper in php
统计信息
- 总下载量: 304
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-12