Here you can find use cases for Triad PHP framework.
- Empty Project contains very basic way to implement MVP handler.
- REST Service contains sample of JSON REST API server that handles simple user creation and editing.
- Smarty Webpage contains sample of custom template engine implementation
- Minimal very basic and simple html handler without using MVP and namespaces
In order to make them working you have to download and copy
latest Triad PHP Framework into /libs/ directory.
If you want to use Redis in REST Service example, download copy
latest Predis PHP library into /libs/ directory - othewise
disable redis in config.php file.
- PHP 5.3 or better
- PDO compatible database for REST Service example
app/- application root (constantAPP_DIR)app/config.php- main configuration file, containing service settingsapp/bootstrap.php- loads framework and autoloader, define default response type hereapp/Exception/- optional - custom app exceptionsapp/Main/Application.php- custom application initialization and error handlingapp/Main/Presenter.php- app parent presenter containing most common method and most used servicesapp/Models/- optional - custom app modelsapp/Presenters/Home.php- default presenter if no other matchapp/Presenters/- custom application presentersapp/Templates/- optional - smarty or other template engine templateslibs/Triad- place Triad PHP Framework here (so that Load.php is underlibs/Triad/Load.php)libs/- optional - other application libraries (constantLIBS_DIR)tmp/- optional - temp storage (constantTMP_DIR)www/index.phporindex.php- loader for application - includesapp/bootstrap.phpwww/or/- folder containing webpage assets, static resources
- Take example of your choice and change main namespace name in app folder -
e.g. forEmpty Projectreplace allMyEmptyProjectto desired name. - update
app/config.phpand define service and webpage settings (database dns, redis, ...) - optional - implement custom response type (smarty), check
Smarty Webpage/app/Main/SmartyResponse.phpexample - set default response type in
app/bootstrap.php - initialize custom services in
app/Main/Application.php(init) - do custom error handling in
app/Main/Application.php(handleException) - define shortcuts for presenters in
app/Main/Presenter.php - start creating and editing presenters in
app/Presenters/...