lastphp is a simple tool for getting summaries of database columns from different databases and displaying them on a webpage.
It's intended use is to view the current user count / last post time across a number of online services via their SQL databases.
This makes it easy to build a page with a summary of activity of you apps and services.
- Tested with PHP 7.2+
- Will require PHP's database module for your database of choice - see database compatibility here
- Simply unzip, and point your vhost to the www directory.
- SSL is highly encouraged
- DO NOT EXPOSE THE ROOT APPLICATION DIRECTORY TO THE WORLD AS THE config.json FILES WILL CONTAIN YOUR DATABASE CREDENTIALS
- Copy config.example.json to config.json
- Key Configuration
- Edit the 'key' option to something unique and secure - you'll need this to access the page after you're done configuring
- Database Configuration
- Required configuration & example values
- 'database_type' => 'mysql'
- 'database_name' => 'name'
- 'server' => 'localhost'
- 'username' => 'your_username' The security of the app is not guaranteed, so I recommend a user with read only permissions only for the required columns
- 'password' => 'your_password'
- Optional configuration & example values
- 'charset' => 'utf8mb4'
- 'collation' => 'utf8mb4_general_ci'
- 'port' => 3306
- 'prefix' => 'PREFIX_' *Table prefix
- 'logging' => true Disabled by default for performance
- 'socket' => '/tmp/mysql.sock' MySQL socket (shouldn't be used with server and port)
- For each database, you can pass an array of fields to get data from and the info you want from them. Fields have the folowing configuration options, all of which are required
- 'description' will be the description put next to the retrieved value in the result data
- 'table' is the database table
- 'field' is the field name
- 'info' is the data to retreive - SUM, MIN, MAX, COUNT, AVG or LAST - last is not standard SQL and will be converted to DESC LIMIT 1
- Repeat with as many databases and fields as you like to build your summary page
- The relays array in configuration can be populated with URLs. lastphp will attempt to pull JSON from those urls and simply repeat it in the results
- Both the 'description' and 'url' fields are required for relays
- config.json format MUST match the format given in the example
- Passing an invalid config.json file will result in the application not functioning at all
Download (PHP 7.2+)
Provided 'as-is' with no warranty expressed or implied. I assume no liaibility or responsibility for any damage this software causes. Use at your own risk. Find this useful? Drop me an email and let me know :)