datatableswebutility / dwuty
dwuty offers an easy way to generate editable tables on your website.
Requires
- php: >=8.1
- components/jquery: ^3.7
- datatables.net/datatables.net: dev-master
- datatables.net/datatables.net-bs5: dev-master
- datatables.net/datatables.net-fixedheader: dev-master
- datatables.net/datatables.net-fixedheader-bs5: dev-master
- select2/select2: ^4.0
- twbs/bootstrap: ^5.3
- vlucas/phpdotenv: ^5.5
This package is auto-updated.
Last update: 2025-02-18 19:27:56 UTC
README
datatableswebutility/dwuty
dwuty provides a simple and easy way to generate editable tables on your website.
The data can be stored in 3 different types of databases via the php pdo interface.
Installation
It's important to add "minimum-stability": "dev"
and "prefer-stable": true
in your composer.json
composer.json
{ "minimum-stability": "dev", "prefer-stable": true }
Install the package through composer:
composer require datatableswebutility/dwuty
Make sure, that you include the composer autoloader somewhere in your codebase.
create .env
file for the environment and update the database credentials
.env
API_KEY="*******" HOST_ENV="*******" DATABASE_ENV="*******" USER_ENV="*******" PASSWORD_ENV="*******"
setup .htaccess
to hide the .env
.htaccess
# Disable index view Options -Indexes # Hide a specific file(s) <Files ~ "\.(env)$"> Order allow,deny Deny from all </Files>
Example (mysql)
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/vendor/autoload.php"; Dotenv\Dotenv::createImmutable($_SERVER['DOCUMENT_ROOT'])->load(); use App\webutility; $config_webutility = array( "debug" => array( "database_tools" => false , "webutility_ssp" => false , "tools" => false ) , "database" => array( "type" => "mysql" , "credentials" => array( "host" => "HOST_ENV" , "database" => "DATABASE_ENV" , "user" => "USER_ENV" , "pass" => "PASSWORD_ENV" ) ) , "crud" => array( "create" => array( "activ" => true ) , "update" => array( "activ" => true ) , "delete" => array( "activ" => true ) ) , "datasource" => "root_table root" , "primarykey" => "root.ID" , "lang_iso_639_1" => "en" ); $obj_webutility = new webutility($config_webutility); $obj_webutility->new_column("root.TEXT_FIELD", "column: TEXT", EDIT, TEXT); ?> <link rel="stylesheet" type="text/css" href="/vendor/twbs/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="/vendor/datatables.net/datatables.net-bs5/css/dataTables.bootstrap5.min.css" /> <link rel="stylesheet" type="text/css" href="/vendor/datatables.net/datatables.net-fixedheader-bs5/css/fixedHeader.bootstrap5.min.css" /> <link rel="stylesheet" type="text/css" href="/vendor/select2/select2/dist/css/select2.min.css" /> <script src="/vendor/components/jquery/jquery.min.js"></script> <div class="container-fluid mt-1"> <?= $obj_webutility->table_header(); ?> </div> <?php $ary_config = array( "default_order" => array( "column_no" => 0 , "direction" => "asc" ) , "datatables_ext" => array( "fixedHeader" => "true" ) ); $obj_webutility->config($ary_config); ?>
Links
You can find more details and examples on datatableswebutility.net & checkout the live - demo