lhaamed/blade-bundler
Composer 安装命令:
composer require lhaamed/blade-bundler
包简介
A super-efficient package to bundle all similar structures for your Laravel blades. Using this package will give you incredible development speed, which is necessary at critical points. You will be able to customize it to any level you want.
README 文档
README
a super efficient package to bundle all similar structures for your Laravel blades. Using this package will give you incredible development speed, which is necessary at critical points. You will be able to customize it to any level you want.
Installation
Like any other packages in the Packagist you'll need to add service provider and Facade aliases into your config/app.php using the following lines:
first of all, you need to run the following command in the root directory of your app in the terminal:
composer require lhaamed/blade-bundler
then, add this as a service provider in the "providers" array:
BladeBundler\BladeBundlerServiceProvider::class,
then add this as an alias in the "aliases" array:
'BB' => BladeBundler\BB::class
never forget to use the following commands in the terminal because you have changed config files.
php artisan optimize
composer du
what is ListBundle
The ListBundle is a Bundle that helps you create the main structure of your lists in a better way using the package principles. you can have different lists for every model and any kind of usage. for example, for showing a list of users you can have different types of lists and in each controller, you can call any of them by just changing the function name in the listGenerator function. the advantage of this system is having both Collection base and Paginated base lists. it means you can pass the data as Collection or Paginated Object and based on the type of data the Bundler generates the desired bundle for you. In this release, there is no view for lists by default. don't forget that we are working on making things easier for you not causing troubles in the dev process. By getting dd() from the ListBundle object you'll find out how to show it in your blade file. not having certain view files for lists helps you bind the ListBundle with your theme at any level of complexity.
how to use ListBundle
this package will help you to organize generating forms and table lists in your app. so you can have full control over all existing forms and lists in any aspect. To have a list you need your $query which could be paginated or not. if you pass the paginated query you'll get the bundle paginated and if you don't it gives the bundle properly. the other parameter that is necessary to make a bundle is a map function. the bundler with pass the query through the map function to generate the list as you desire.
$paginated_query = User::paginate(30)->onEachSide(2); $listBundle = BB::generateList($paginated_query,['this','defaultListMap']);
or
$collected_query = User::all(); $listBundle = BB::generateList($collected_query,['this','defaultListMap']);
so let's take a look at the map function structure.
public static function defaultListMap(listBundle $listBundle ,LengthAwarePaginator|Collection $query): listBundle { $items = BB::getQueryItems($query); $mappedData = array_map(function ($eachRecord) use ( $query) { $recordModel = $query->find($eachRecord['id']); $action_links = []; return [ $recordModel->showName(), $recordModel->showLastname(), 'actions' => $action_links ]; }, $items); $listBundle->setTitle('custom title for the list'); $listBundle->setTableHeader([ 'name', 'lastname', 'actions', ]); $listBundle->setTableRecords($mappedData); return $listBundle; }
in this function, you define what are the heads and each cell's exact value. so you have full control over your list in a better way.
what is FormBundle
The FormBundle is a Bundle that helps you create forms in Bootstrap structure. After creating the Form via the FormGenerator you have to append a new section. In each section, you are allowed to append rows and inside the rows, you can append your cells. each cell contains input and you can see the list of supported inputs in the following:
License
lhaamed/blade-bundler 适用场景与选型建议
lhaamed/blade-bundler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 01 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lhaamed/blade-bundler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lhaamed/blade-bundler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-27