robertseghedi/laravel-autofetcher
Composer 安装命令:
composer require robertseghedi/laravel-autofetcher
包简介
This is a fresh Laravel plugin which gets data from your database, caches it and gets it ready for displaying on your amazing page. It is really simple to use, so it might not puzzle you.
README 文档
README
The most powerful and efficient Laravel plugin for proper data-fetching
This is a fresh Laravel plugin which gets data from your database, caches it and gets it ready for displaying on your amazing page. It is really simple to use, so it might not puzzle you.
Instalation
First, you have to install the package using composer in your project root folder:
composer require robertseghedi/laravel-autofetcher
Then, you have to add the provider to your config/app.php like that:
// your providers RobertSeghedi\Autofetcher\AutofetcherProvider::class,
Information
| Command name | What it does |
|---|---|
| Autofetch::database($table, $time - in seconds) | Lists all the results from the table you mention |
| Autofetch::result($table, $type (first/last), $time - in seconds) | Lists only the first/last result from the table you mention |
| Autofetch::select($table, $selected_fields, $time - in seconds) | Lists all the results from the table you mention, but only the mentioned fields |
| Autofetch::top($table, $orderby, $number_of_results, $time - in seconds, $type) | Lists all the results from the table you mention, but only the mentioned fields |
| Autofetch::lazy($table, $orderby, $number_of_results, $time - in seconds) | Lazy-lists all the results from the table you mention, but only as much results as you mentioned |
Usage
Now you can start using the package.
1. Include it in your controller
use RobertSeghedi\Autofetcher\Models\Autofetch;
2. Start extracting fresh data
public function fetch_table($table = null) { $x = Autofetch::database($table); return $x; }
public function fetch_top_donators($table = null) { $x = Autofetch::top($table, 'donated_money', 10, 1800, 'public'); return $x; }
- $table - the table's name that you want to extract data from
- 'donated_money' - the order-by-field's name
- 10 - number of results (so the above code will return a top 10)
- 1800 - the number of seconds for which the data will be cached
- 'public' - the public option is for efficient data-caching & displaying the data on a public website which doesn't require refresh-updated data. If you use the public option, your user-cached data won't refresh until the specified time is up. If you use the private option, your user-cached data will refresh instantly. The private option is good if you are developing an admin dashboard or a limited-access app.
3. Display it as you wish
Follow this package for future updates
robertseghedi/laravel-autofetcher 适用场景与选型建议
robertseghedi/laravel-autofetcher 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 robertseghedi/laravel-autofetcher 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 robertseghedi/laravel-autofetcher 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-28