Repository navigation
0.1.0
Turn one PHP script into an internal tool with a web page. You write no HTML, no JavaScript, no controller and no template.
composer require runio/script-uiThe readme shows a first tool, every function, and how to put the tools behind the login of your own application.
First version. Requires PHP 8.2+ with the mbstring and session extensions, and no other package.
Added
- A tool is one PHP script. It runs from top to bottom and runs again on every interaction.
- Text and messages:
title,heading,note,code,json,link,divider,metric,success,info,warning,error. - Inputs that return their current value:
text,textarea,number,select,checkbox,date_input. radioshows every option and takes one.multiselectshows a tick box for every option and returns the ticked ones as a list. Both take their options the wayselectdoes, lay them out in a column, in several columns or in a row (horizontal: true), and can be filled in by a link.tablewith sorting, pages (pageSize:), a search box (search: true) and rows you can tick on any page, one by one or a page at a time.chartwith bar and line charts drawn as SVG.buttonwith an optional question before it acts, pluscolumns,stopandrerun.expanderputs a part of the page under a line that opens and closes it, andtabsputs parts behind headers with one of them in view. What is out of sight still runs: the inputs inside keep working, and opening a part or changing the tab needs no run of the tool. The page remembers what was left open.refreshlets a page run again by itself every few seconds, for dashboards and queues. It waits while the user is in the middle of something, stops while the page is out of sight or nobody is there, waits longer after failures, and never presses a button or changes what the page remembers.field_errorsays under an input what is wrong with what it holds, andvalidtells whether anything was found wrong. After a pressed button the first wrong input gets the keyboard focus, and an expander or a tab that hides it comes into sight. Screen readers are told that the input is invalid and read the note with it. A file that a file field turns down is marked in the same way and counts forvalid. The log entry of a press says what was found wrong.file_inputtakes files from the user: one or several, with limits on size and kind. A file stays on the server between the runs of a tool, in a folder only PHP reads, and the page names it by a random handle.Uploadgives the toolname,size,path,contents(),saveTo()andforget(), androws()reads an uploaded CSV file as rows, whichever spreadsheet wrote it.uploads:sets the folder,clean_uploads()deletes what was left behind.downloadhands the user a file: rows as CSV or JSON, or any text.csvwrites rows as CSV with a choice of columns and separator. Cells that a spreadsheet would run as a formula are defused.serve()for a folder of tools with an index page,configure()for a script on its own, and thescript-ui servecommand for local use.- A login check and an audit log (
auth,log), protection against forged requests, a strict Content-Security-Policy, and local-only access while no login check is set. - The help text of an input is read out with the input by software that reads the page.
- Pages update in place with JavaScript and work as plain forms without it. A title in Arabic or Hebrew turns the page right to left.
- The library's own texts ("Yes", "Reset", "No rows.") in English, Arabic and German. A page follows the language of its title,
language:sets one language for every page, andtexts:replaces single texts or adds a language.