Skip to content

All diagrams ​

Every diagram of this site in one place. Each one also stands on the page where it explains something, and the heading above it leads there.

Who uses it, and what for ​

From What it is for.

Script UI, inside your applicationWrite a tool as one PHP scriptSay who may open which toolRead who pressed what, and whenOpen a tool from the listSearch, sort and page through dataChange data with a buttonSend a file in, fetch a fileWatch a task that takes longA developerA colleaguesupport, finance, opsYour applicationlogin, rights, dataA workerqueue job, cron
Who does what. A developer writes a tool and says who may open it. Colleagues use it. Your application checks the login and holds the data, and a worker does the long work.
A small internal page, by handA routethe address of the pageA controllerreads the request, calls your codeA templatethe HTML of the form and of the resultValidation and a form tokenwhat may be typed, and that the form is yoursJavaScriptfor what changes without a reloadbecomesThe same page, with Script UItools/refund.phpthe inputs, the checks, the work andthe result, from top to bottomThe form, its token, the escapingand the design come with the library.
The same small page, built by hand and written as one script.
Is it for people inside,behind a login?Is it mostly records to list,create, edit and delete?Is it a task: a few inputs,a button, a result?yesnononoA page of your applicationScript UI is not for the publicyesAn admin generatorEasyAdmin, Filament, NovayesScript UIone script for one taskA page you build by handfull control, more work
Three questions that tell whether Script UI fits.

What happens on a click ​

From How it works and Safety and limits.

The browserScript UIYour scriptthe whole form: every input,and the button that was pressedchecks the login, the tooland the token of the formruns it from the toptext('Customer email')what the user typedbutton('Refund')true, in this run onlydoes the work:your code, your datathe end of the scriptthe new pageswaps the content, no reload
One click, from start to end. Every interaction sends the whole form, and the script runs again from the top.
Who is asking?auth:May they openthis tool?allow:Is the form ours?asked when a form comesin: it carries a tokenYour script runsfrom top to bottomevery request, also a clickyesnoyesnoyesnoRefusednobody is logged inRefused"Not allowed"Refuseda forged requestThe page
What a request passes before a line of your script runs. A page that is only opened sends no form, so the third question is not asked of it.

Where it runs ​

From Inside your application.

On your computerPHP's own serverscript-ui serve toolsserve()sends the page itselftools/*.phpyour scripts, outside the web rootthe requestruns one of themNo login check:only this computer gets in.Behind your web serverYour web serverruns public/admin.phpserve(auth: ...)sends the page itselftools/*.phpyour scripts, outside the web rootthe requestruns one of themYour own session sayswho is asking.Inside Symfony or LaravelThe frameworka route and a controllerrespond()hands the page backtools/*.phpyour scripts, outside the web rootthe requeststatus, headers, bodyruns one of themThe login, the session and thecookies of the framework.
Three ways to host. The difference is who sends the page, and where the login comes from.

Large data and long work ​

From A table of 100,000 rows and A task that takes long.

The browsershows 25 rows of 100,000table()trusts nothing as it comesYour functionone query for one pagethe requesta TableQuery25 rowsthe pageThe browser sendspage 3sort by column 2search: müllera numbera place in your sortable: lista textYour function gets a TableQuerysearch 'müller'sort 'c.name'limit 25, offset 50to bind as a parameterthe value you wrote, not the browserwhole numbers the table worked outWHERE ... LIKE ? ORDER BY c.name, id LIMIT 25 OFFSET 50
A table that reads from the database. Nothing the browser sends reaches your query as it came.
Your toolrefresh(2) and progress()Your storageone row: state, done, totalA workerqueue job, cron, commandStart: writes the rowpicks the task upwrites how far it is, as it goesevery 2 seconds: reads the numbersa run takes a fraction of a secondone run, for minutes or hours
A task that takes long. The page never does the work: it looks at it every two seconds.
waitingprogress('Waiting')runningprogress(label, done, total)finishedsuccess(), download()failederror()stoppedwarning()a workertakes itthe worker gave upall of it is donesomebody asked to stop
The states of a task, and what the tool shows in each.

Released under the MIT License.