2017 © Pedro Peláez
 

library listr

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

image

devrtips/listr

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

  • Tuesday, March 6, 2018
  • by malitta
  • Repository
  • 1 Watchers
  • 6 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 7 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Listem

Build Status, (*1)

Listem is an easy to use (but highly customizable) data sorting and filtering module for PHP >= 5.4, which can be used for data lists/tables/grids, reports or APIs., (*2)

Installation

Make sure you have Composer installed and run the below command from your project directory., (*3)

composer require listem/listem-php

General Usage

Set configurations and initialize., (*4)

$config = [
    'filters' => [
        'name' => ['label' => 'Title'],
        'content' => ['label' => 'Content', 'column' => ['content', 'summary']],
        'state' => [
            'label' => 'State',
            'type' => Listem\Filter::ENUM_INPUT,
            'enums' => [
                1 => 'Active',
                0 => 'Draft'
            ]
        ],
        'created_at' => ['label' => 'Created On', 'type' => Listem\Filter::DATE],
        'category' => ['label' => 'Category', 'type' => Listem\Filter::ENUM_SELECT]
    ],
    'sorters' => [
        'name' => ['label' => 'Full Name', 'column' => 'users.name'],
        'active' => ['label' => 'Active', 'column' => 'users.active']
    ]
];

$list = new Listem\ListEntity($config, new Listem\Conditions\MySQL, new Listem\Params\Get);

$filters = $list->getFilters();
$sorters = $list>getSorters();

$filterConditions = $filters->getConditions();

$sorterConditions = $sorters->getConditions();

$data = BlogPost::whereRaw($condition);
    ->orderBy($sorterConditions['column'], $sorterConditions['side'])
    ->get()
    ->toArray();

Pass $filters and $sorters to your view and render them easily., (*5)



renderLabel() ?> renderFormElem() ?>
< table> <thead> <tr> <th><?php $sorters->render('title') ?></th> <th>Slug</th> <th><?php $sorters->render('content') ?></th> <!-- Or you can render parts of it, so you have more control --> <th> <a href="<?php $sorters->getLink('created_at') ?>"> <?php $sorters->getLabel('created_at') ?> <span class="<?php $sorters->sorted('created_at') ? 'up' : 'down' ?>"></span> </a> </th> </tr> </thead> ...

Documentation

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*6)

License

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

The Versions

06/03 2018

dev-master

9999999-dev

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Malitta Nanayakkara

07/04 2016

dev-dev

dev-dev

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Malitta Nanayakkara

25/01 2016

dev-testing

dev-testing

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Malitta Nanayakkara

24/01 2016

dev-restructure

dev-restructure

Listr is an easy to use (but highly customizable) data sorting and filtering module for PHP, that can be used for data lists/tables/grids, reports or APIs.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Malitta Nanayakkara