Download the PHP package adods/page-marker without Composer
On this page you can find all versions of the php package adods/page-marker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adods/page-marker
More information about adods/page-marker
Files in adods/page-marker
Package page-marker
Short Description Library for saving CRUD list filter in request query
License MIT
Informations about the package page-marker
Page Marker
A Simple Library for remembering/recording URL Query String used for filtering list
Installation
Via Composer:
or just download the file manually and put in your lib directory
Requirement
PHP >= 7.0
and PHP Session enabled
Simple Usage
Include the library to your file, create instance, init()
and remember()
.
Use forget()
to reset.
init()
By default, init()
will generate default name from current URL Path,
lowercased, then replace slashes '/'
, dots '.'
, stripes '-'
, and spaces
' '
to underscore _
. Set default url to current url without it's query
string. And use the content of $_GET Super Global variable as base data. But,
it can be changed.
After default properties are set, then it will check if redirect to the last state is met or just go on with the process.
The conditions are:
- If the base data contain a reset key element, then the remembered session will be erased and will be redirected to the base URL.
- If the base data is not empty, then process will continue normally
- Then it will check the session for existing data.
- If session data is empty, then process will continue normally
- Lastly, it will redirect to the base URL with the data from session as Query String parameters
Main Settings/Setup
Settings below should be set BEFORE init()
.
Session Name:
Name is used as part of the session key.
Name should be easy to read and descriptive about the list and also array key
friendly. And any characters mentioned above will be replaced with underscore
'_'
Change base URL:
Any query string will be omitted.
Change base data source
More Function
Add/Change data
Using array as parameter will merge the array with current data
Excluding data
Remember Options
Data can also overrided from remember()
method.
By default, the given parameter will REPLACE the current base data. To add them,
you can use PageMarker::OVERRIDE_APPEND
constant as second parameter.
Manually Forget/Reset
Get Forget/Reset URL
Full Example
Try to add parameters to the URL. Everytime the base URL accessed it will automatically redirect with last state URL with Query String Parameters. Click on Reset link to clear all the saved data.