simonbarrettact/unsplash
Composer 安装命令:
composer require simonbarrettact/unsplash
包简介
A Laravel Nova field.
README 文档
README
This custom field has the ability to fetch and display an image from Unsplash in Laravel Nova.
Installation
composer require simonbarrettact/unsplash
The Unsplash field requires you to set up an Unsplash access key.
Get your Unsplash access key from the developer dashboard after creating an app with them.
Once you have done that, add the following line, containing your key, to your .env file.
UNSPLASH_ACCESS_KEY=<your access key>
Then add your access key to the config/services.php file:
return [ // ... 'unsplash' => [ 'access_key' => env('UNSPLASH_ACCESS_KEY') ], ];
Usage
Before using the field it will be necessary to add a column to your table.
/** * Run the migrations. * * @return void */ public function up() { Schema::table('my_table', function (Blueprint $table) { $table->string('unsplash_id', 20); }); }
To add your field to a resource:
use SimonBarrettACT\Unsplash\Unsplash; ... public function fields(Request $request) { return [ ... Unsplash::make('Photo', 'unsplash_id'), ... ]; }
Options
Unsplash::make('Photo', 'unsplash_id') ->queryPlaceholder('Provide a topic to search for') //Optional ->orientation('landscape') //Optional - landscape, portrait or squarish ->previewSize('regular') //Optional - thumb, small, regular, full ->featured(true), //Optional - set to true to only display 'featured' images
Searching for images
To search for an image using the field, enter a topic to search for and click the 'Search' button. A random image will be displayed. Repeated presses of the button will generate other random images. Leaving the search box empty will return a random image on any topic.
This feature is fairly basic at the moment but will be improved in future releases.
If you know the Unsplash photo's id enter it in the second input box.
Displaying images in your app
For the easiest way of displaying Unsplash images please check out Blade UI Kit.
simonbarrettact/unsplash 适用场景与选型建议
simonbarrettact/unsplash 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 137 次下载、GitHub Stars 达 4, 最近一次更新时间为 2020 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simonbarrettact/unsplash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simonbarrettact/unsplash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simonbarrettact/unsplash 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 137
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-18
