esdeathlove/datatables
Composer 安装命令:
composer require esdeathlove/datatables
包简介
PHP Library to handle server-side processing for Datatables, in a fast and simple way.
README 文档
README

PHP Library to handle server-side processing for Datatables, in a fast and simple way. Live Demo
Features
- Easy to use. Generates json using only a few lines of code.
- Editable columns with a closure function.
- Supports mysql and sqlite for native php.
- Works with laravel and codeigniter3
How to install?
Installation via composer is supported.
If you haven't started using composer, I highly recommend you to use it.
Put a file named composer.json at the root of your project, containing this information:
{
"require": {
"ozdemir/datatables": "1.*"
}
}
And then run: composer install
Or just run : composer require ozdemir/datatables
Add the autoloader to your project:
<?php require_once 'vendor/autoload.php'
You're now ready to begin using the Datatables php library.
How to use?
A simple ajax example:
<?php require_once 'vendor/autoload.php'; use Ozdemir\Datatables\Datatables; use Ozdemir\Datatables\DB\MySQL; $config = [ 'host' => 'localhost', 'port' => '3306', 'username' => 'homestead', 'password' => 'secret', 'database' => 'sakila' ]; $dt = new Datatables( new MySQL($config) ); $dt->query("Select film_id, title, description from film"); echo $dt->generate();
Methods
This is the list of available public methods.
- query ( $query : string )
(required) - edit ($column:string, Closure:object )
(optional) - generate ( )
(required)
Example
<?php $dt = new Datatables( new MySQL($config) ); $dt->query("Select id, name, email, address, plevel from users"); $dt->edit('id', function($data){ // return an edit link. return "<a href='user.php?id=" . $data['id'] . "'>edit</a>"; }); $dt->edit('email', function($data){ // return mail@mail.com to m***@mail.com return preg_replace('/(?<=.).(?=.*@)/u','*', $data['email']); }); $dt->edit('address', function($data){ // check if user has authorized to see that $current_user_plevel = 4; if ($current_user_plevel > 2 && $current_user_plevel > $data['plevel']) { return $data['address']; } return 'you are not authorized to view this column'; }); echo $dt->generate();
Requirements
DataTables > 1.10
PHP > 5.3.7
License
Copyright (c) 2015 Yusuf ÖZDEMİR, released under the MIT license
esdeathlove/datatables 适用场景与选型建议
esdeathlove/datatables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 138.47k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 esdeathlove/datatables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 esdeathlove/datatables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 138.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-18