定制 pascalkleindienst/form-list-generator 二次开发

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

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

pascalkleindienst/form-list-generator

Composer 安装命令:

composer require pascalkleindienst/form-list-generator

包简介

Small library to easily display data as a table-list or a form. Its main application area is in admin/backend applications.

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Code Style Total Downloads

FormListGenerator is a small library to easily display data as a table-list or a form. Its main application area is in admin/backend applications.

Install

Via Composer

$ composer require pascalkleindienst/form-list-generator

Usage

use PascalKleindienst\FormListGenerator\Generators\ListGenerator;
use PascalKleindienst\FormListGenerator\Generators\FormGenerator;
use PascalKleindienst\FormListGenerator\Support\Config;

# set the root path of the application and optionally a baseUrl
Config::set([
    'root'    => dirname(__FILE__),
    'baseUrl' => 'http://example.com'
]);

// Init Generators with yaml config
$list = new ListGenerator('list.yaml'); 
$form = new FormGenerator('form.yaml');

// Alternatively, we can use the load method (useful when you put the generator class in a container)
$list = new ListGenerator(); 
$form = new FormGenerator();
$list = $list->load('list.yaml');
$form = $form->load('form.yaml');

// Render List
# some example date, usually fetched from your DB
$listData = [
    [
        'id'         => 1,
        'full_name'  => 'John Doe',
        'age'        => 42,
        'created_at' => time(),
        'content'    => 'lorem ipsum',
        'recursive'  => [ # accessed via dot notation in yaml => recursive.test or recursive.foo
            'test' => 'Recursive Testing',
            'foo'  => 'Foo'
        ]
    ],
    [
        'id'         => 2,
        'full_name'  => 'John Doe',
        'age'        => 42,
        'created_at' => time(),
        'content'    => 'lorem ipsum',
        'recursive' [ # accessed via dot notation in yaml => recursive.test or recursive.foo
            'test' => 'Recursive Testing',
            'foo'  => 'Foo'
        ]
    ]
];
$list->render($listData);

// Render the form
$formData = [
    'id'         => 1,
    'full_name'  => 'John Doe',
    'age'        => 42,
    'created_at' => time(),
    'content'    => 'lorem ipsum',
    'recursive' [ # accessed via dot notation in yaml => recursive.test or recursive.foo
        'test' => 'Recursive Testing',
        'foo'  => 'Foo'
     ]
];
$form->render($formData);

Configuration

See docs/form.md and docs/list.md

Localization

You're also able to translate your message to another language. The only thing one must do is to set the attribute translator as a callable that will handle the translation:

$form->setTranslator('gettext');
$list->setTranslator('gettext');

The example above uses gettext() but you can use any other callable value, like [$translator, 'trans'] or your_custom_function().

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email mail@pascalkleindienst.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固