定制 amirsadjad/simple-list-formatter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amirsadjad/simple-list-formatter

Composer 安装命令:

composer require amirsadjad/simple-list-formatter

包简介

Simple list formatter for UI development ease of use.

README 文档

README

Simple list formatter for UI development ease of use.

This id a package to format your collections of data based on the UI needs. You can format "laravel collection", "eloquent collection" and "array". you can create a preset for every page of your application in the database and then just pass the data and preset to the facade and get the parsed result with desired columns, with sortability, searchability and dynamic paging. you can also pass metadata to the preset and it will be delivered to UI with the resultint list.

For installation run:

composer require amirsadjad/simple-list-formatter

then publish the config file by running:

php artisan vendor:publish --tag=simple-list-formatter-config

to migrate the table run:

php artisan migrate

Basic Usage:

use Amirsadjad\SimpleListFormatter\Facades\SimpleList;

// you need to start by using the function Of()
$list = SimpleList::Of($data, $preset);

// you can chain other methods
$list->search($query);
$list->sortBy($columnName, false);
$list->pageNumber($pageNumber);

// you have to run the generate() at the end to parse the data
$list->generate()

To interacting with presets table you can either use the Model class

SimpleListPresets::find($name);

// preset data needs to be formatted like this
$preset = [
  'columns' => [
    'column_name' => [
      'data_type' => 'string',
      'is_sortable' => 'bool',
      'is_searchable' => 'bool',
      'width' => 'int',
      'title' => 'string',
      'metadata' => 'array'
    ],
    ...
    ..
    .
  ],
  'page_size' => 'int',
];

Or you can use the built in APIs: https://www.getpostman.com/collections/64bcf64f6a05fc87cc8b

You can see an example of how to use this package in a project here: https://github.com/Amirsadjad/simple-list-formatter-example

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-16