PHP libraries

Editor comes with a set pre-built PHP (5.3+) libraries which are designed to make it super easy to create a script on the server-side that will provide an anchor point for Editor's client-side scripts. Client / server communication is required in order to provide the initial data for the DataTable and then for Editor to instruct the server to create, edit or delete rows as required by the end user. The PHP libraries can do this for you in just a few lines.

This section of the Editor manual goes into detail about how to setup, configure and use the Editor PHP libraries.

Reference documentation is also available for Editor's PHP libraries, which document in detail the API interfaces and options of the PHP classes.

PHP libraries manual

Installing

DataTables and Editor are powerful libraries, but before you can use them, they need to be installed on your system! This guide walks through how to download the Editor PHP package and set it up. The end result will be the ability to run all of the Editor examples on your own web-server, ready for your to customise and experiment with as you need. This installation is a simple four step process which this documentation below will quite you though. Read more »

Getting started

Editor comes with a set pre-built PHP (5.3+) libraries which are designed to make it super easy to create a script on the server-side that will provide an anchor point for Editor's client-side scripts. Client / server communication is required in order to provide the initial data for the DataTable and then for Editor to instruct the server to create, edit or delete rows as required by the end user. The PHP libraries can do this for you in just a few lines. Read more »

Validation

Validation of data is a fundamentally important aspect of a CRUD application. You need to be sure that the data that the client is sending you is what you expect. This is not just for security reasons, protecting your data from misuse and intentional corruption, but also simply from unintentional mistakes in submitting data. Strings limited to a certain length, dates in a particular format and required fields are all common uses of data validation. Read more »

Formatters

Often the data that is stored in the database is not in a format that is suitable for display or manipulate by the end user. A common example of this is a timestamp - the number of seconds since 1st January 1970 means very little to anyone, even extremely experienced developers, but it is a very useful format to hold the data in, since it can be sorted and filtered extremely quickly in the database. For this reason the Field class provides get and set formatters - specifically the getFormatter and setFormatter methods. Read more »

Joins

A cornerstone of CRUD applications is the ability to combine information from multiple SQL tables, representing the combined data as a common data set that the end user can easily understand and manipulate. Relational databases are, after all, designed for exactly this sort of data referencing. Often in CRUD applications, working with such joined data can significantly increase the complexity of the application and increase development time, Editor makes working with such join tables extremely easy through its leftJoin() method. Complex joins with full CRUD support can be added in just minutes. Read more »

One-to-many joins

The Editor class' leftJoin() method is excellent when using a 1:1 relationship between joined tables and is optimised for that data structure. However, it doesn't support a one-to-many option due to the formatting of the generated SQL statement. To provide one-to-many support the Editor PHP libraries include a Mjoin class. Read more »

Where Conditions

When displaying data from a database to an end user you may require the ability to filter the data that the end user sees (for example based on account permissions or some other account access permissions). In SQL you would do this with a WHERE condition - the Editor PHP libraries also provide a Editor->where() method to expose this functionality and allow complex conditional expressions. Read more »

Events

When working with complex data, it can often be useful to perform some additional action when Editor updates the database based on information from the client-side. This can take the form of modifying the Editor or Field instances for the action being taken, deleting files from the file system when rows are removed, or adding log information to a database about an action that a user has taken. To make this possible, the PHP Editor class provides an event listener / callback option similar to the events that the client-side Javascript will trigger. Read more »

File Upload

The Editor PHP libraries provide an Upload class that can be used with the upload and uploadMany field types to provide end users with the ability to upload files to a server. The goal of the Upload class is to make the server-side aspect of file uploading as simple as possible, while retaining the same flexibility that you would expect from the Editor libraries. Read more »