Download the PHP package mezon/common-application without Composer
On this page you can find all versions of the php package mezon/common-application. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mezon/common-application
More information about mezon/common-application
Files in mezon/common-application
Package common-application
Short Description Common application for basic purposes
License MIT
Homepage https://github.com/alexdodonov/mezon-common-application
Informations about the package common-application
Common application class
Intro
This class provides simple application routine with more complex rendering and error handling.
Extended routes processing
In Application class routes may return only strings. But CommonApplication class allows you to return arrays of string which will be placed in the template placeholders.
Simple example:
Here route's handler generates two parts of the page /simple-page/ - 'title' and 'main'. These two part will be inserted into {title} and {main} placeholders respectively.
More complex example:
Here we pass instance of the class View (or any class derived from View) to the application page compilator. It will call View::render method which must return compiled html content.
Routes config
You can also keep al routes in configs. You can use json configs:
This data must be stored in the './conf/' dir of your project. Or load configs explicitly as shown below (using method loadRoutesFromConfig).
And we also need these methods in the application class.
Note that you can load multiple configs with one call of the method loadRoutesFromConfigs
Or the same:
All versions of common-application with dependencies
mezon/application Version 3.0.*
mezon/html-template Version >=1.1.10 <1.2.0