Download the PHP package phpbootstraptableedit/phpbootstraptableedit without Composer
On this page you can find all versions of the php package phpbootstraptableedit/phpbootstraptableedit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpbootstraptableedit/phpbootstraptableedit
More information about phpbootstraptableedit/phpbootstraptableedit
Files in phpbootstraptableedit/phpbootstraptableedit
Package phpbootstraptableedit
Short Description Database table editor, datagrid, themed with Bootstrap css
License MIT
Informations about the package phpbootstraptableedit
PHP Bootstrap Table Edit - datagrid library to edit database tables
-
Define table, forms, and inputs using SQL statements
-
Search, column sorting, pagination, no javascript required
-
File and image uploads to filesystem or into database field (blob)
-
No built-in validation, instead it's encouraged to use HTML's pattern attribute, and the required property
-
Hooks available to add validation, format data, or run code, on or after: inserts, updates, and deletes
- Styled with Bootstrap css framework
License
MIT
Screenshots
Requirements
- PHP 7+ with mbstring and gd extensions enabled
- SQLite 3, MariaDB/MySQL, or PostgreSQL
Status
This project is currently beta
Quick demo using SQLite3 and PHP's built-in webserver
- navigate a terminal to the 'examples/' folder
- sqlite3 example.db < example.sql
- php -S localhost:8080
- open web browser to http://localhost:8080
Install from composer
Important Terminology - index, add, edit
- "index" is the opening table showing all records, pagination, and search
- "add" is the form to insert new records
- "edit" is the form to update existing records
[!CAUTION] Stop SQL injection attacks, never place user input into SQL strings! Instead, use sql_param arrays to safely pass input.
[!TIP] Use the nonce properties to prevent Cross-site Request Forgery attacks (CSRF).
Basic Example
Properties
charset (string), output charset, default: 'UTF-8'
table_name (string), database table
identity_name (string), the auto increment id field in the table, typically 'id'
index_sql (string), sql query to define the opening html table listing all records
index_sql_param (array), parameters for index_sql
Example:
add_sql (string), sql query to define what fields to display on the add page, also what fields are in the insert
Example:
add_sql_param (array), named parameters for add_sql, typically not required since no records are retrieved
edit_sql (string), sql query to define what fields to display on the edit page, also what fields are used in the update
Example:
edit_sql_param (array), named parameters for edit_sql
Example:
add (array), define how fields in add_sql are rendered on the add form
Example:
edit (array), define how fields in edit_sql are rendered on the edit form
Example:
index (array), define hooks to render fields on the opening table, function name, or closure
Example:
floating (bool), enable Bootstrap's floating labels on add and edit forms. https://getbootstrap.com/docs/5.3/forms/floating-labels/
nonce_name (string), csrf field name, default 'nonce'
nonce_value (string), csrf field value
limit (int), pagination limit records/page, 0 = off, default = 100
ellipse_at (int), truncate text on index table, 0 = off, default = 0
query_string_carry (array) entries in this array added to all query strings, useful to carry data from page to page
Example:
i18n (array), associative array containing all localization settings
Defaults:
css (array), css class settings
Defaults:
redirect (bool) helpful when debugging, set to false and page will not redirect after insert/update/delete
'on' Event Hooks
'on' event hook functions are called before the sql insert/update/delete. 'on' functions can be used to cast POST data or add validation. Returning a string from an 'on_' function displays an alert on the add/edit form and skips the insert/update/delete.
- on_insert (closure or function name)
- on_update (closure or function name)
- on_delete (closure or function name)
Text Only Alert:
HTML and Text Alerts:
'after' Event Hooks
after functions are called after the SQL insert/update/delete. after_insert is a unique hook, it's receives an argument; the inserted id.
- after_insert (closure or function name)
- after_update (closure or function name)
- after_delete (closure or function name)
Examples:
Normal HTML Attributes
Standard HTML attributes can be set in the add and edit arrays. They are passed through as expected
Custom HTML Attributes
Custom attributes instruct this library how to render the input. Unlike normal HTML attributes, such as maxlength, custom attributes do not appear in the input.
- colspan (string) Bootstrap forms have a 12 column layout, so using '4' on all fields would creates a 3 column layout; 12/4 = 3
Example:
- div_class (string) add a class to the div wrapping the input
Example:
- label (string), rename the title appearing with the field
Example:
-
sql (string) sql statement to populate a select, radio, or checkbox input Example:
- sql_param (array), associative array to hold named parameters for sql
Example:
Custom HTML Attributes for File Uploads
- file_extension (string) Define what type of file to accept. For images, valid formats are png, gif, jpg, format and meta are verified at upload. For non-images, such as doc or pdf, format and meta are not verified at upload.
Example:
- file_path (string) Optional, filesystem location for files to be uploaded to; a filename is stored in the database field. If no file_path is specified, the binary content is stored directly into the database field, and no filename is saved.
Example:
- file_image_width (int) Optional, when file_extention is png, gif, or jpg, specify a desired width.
Example:
- file_image_height (int) Optional, when file_extention is png, gif, or jpg, specify a desired height.
Example:
- file_image_crop_or_resize (string, 'crop' or 'resize') optional, specify how to resize the image when file_extention; for png, gif, or jpg only. 'crop' creates an image accoring to width and height settings. 'resize' maintains aspect ratio of the original image while limiting size to width and height settings. Example:
Label - Rename a field
Rename the title appearing with the field Example: