tnt-freskim-veliu/livewire-spotlight-search
Composer 安装命令:
composer require tnt-freskim-veliu/livewire-spotlight-search
包简介
Laravel Livewire spotlight search component
README 文档
README
This package allows you to build a Livewire spotlight search.
Installation
You can install the package via composer:
composer require tnt-freskim-veliu/livewire-spotlight-search
Requirements
This package uses livewire/livewire (https://laravel-livewire.com/) under the hood.
It also uses TailwindCSS (https://tailwindcss.com/) for base styling, and Alpine JS (https://alpinejs.dev/) for reactivity.
Please make sure you include all of them dependencies before using this component.
Usage
In order to use this component, first you have to include script directive:
@livewireSpotlightSearchScript
and then you can put the component: <livewire:spotlight-search />
after you have to publish config file:
php artisan vendor:publish --tag=livewire-spotlight-search-config
in the config you have to fill searchable key with classes that implements Searchable contract.
Example you can declare the UserSearch class that will handle the search.
return [ 'searchable' => 'App\SpotlightSearch\UserSearch' ];
Each class must include these methods like in example:
class UserSearch implements Searchable { public function search(string $query): array { return User::query() ->where('name', 'LIKE', "%$query%") ->take(25) ->get() ->toArray(); } public function group() { return "Users"; } public function onSelect($id, Component $component) { //handle logic when the item is clicked } }
The search modal can be open in many ways:
Cmd+k
Cmd+/ or by dispatching a browser event with name open-spotlight.
Please don't forget to change tailwind.config.js content part, by adding:
./vendor/tnt-freskim-veliu/resources/views/*.blade.php, so tailwind will recognise the classes that we use.
Currently we support the dark mode and light mode by passing:
:on-dark-mode="bool""
TODO
- Add functionality to navigate inside items with keyup and keydown.
- Add command that will create spotlight search classes
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email freskim.veliu@gmail.com or use the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
tnt-freskim-veliu/livewire-spotlight-search 适用场景与选型建议
tnt-freskim-veliu/livewire-spotlight-search 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「livewire」 「freskim-veliu」 「livewire-spotlight-search」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tnt-freskim-veliu/livewire-spotlight-search 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tnt-freskim-veliu/livewire-spotlight-search 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tnt-freskim-veliu/livewire-spotlight-search 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Livewire starter kit for Lunar e-commerce.
Abstraction Layer to index and search entities
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
Livewire component that provides drawers (slide overs) that support multiple children while maintaining state.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-12