Download the PHP package bchubbweb/phntm without Composer
On this page you can find all versions of the php package bchubbweb/phntm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bchubbweb/phntm
More information about bchubbweb/phntm
Files in bchubbweb/phntm
Package phntm
Short Description A server side stack, focused on DX and simplicity
License MIT
Informations about the package phntm
phntm
A lightweight framework designed to feel like magic; handling the boring bits of a modern web application, as if something (or someone) is doing it for you.
Installation
To install require the package to your project:
Setup
Create a .htaccess file with the following contents at the base of your project
Obviously you must then add index.php in the base of your project, to start, add the following contents:
This will set up the namespace router, and determine what to do with the current request.
Next, add the Pages namespace to your composer.json pointing to the directory you wish to use, although I would recommend pages/ in the base of your project.
Then start your local server and do as you wish
Pages
pages within your pages directory should extend the bchubbweb\phntm\Resource\Page class, and have to be named Page.php, this lets the router know this namespace can be routed to.
Layouts
Similar to NextJS, phntm uses layouts to wrap around the content of a page, this is useful for things like headers and footers, shared assets and more.
The comments are used to inject the content of the page into the layout, registered assets and the profiler script if enabled.
Unlike NextJS, layouts are limited to one deep, so the closest layout in the namespace for a given page will be used.
Profiling
To use the phntm profiler pass true to the Phntm::init() function, this will profile the request and inject the profiler script into the layout.
The script then fetches the cached profile data from the /api/profiler endpoint, and displays it in a table.