-
Notifications
You must be signed in to change notification settings - Fork 2
Widget
Viames Marino edited this page Feb 22, 2026
·
1 revision
Pair\Html\Widget renders reusable PHP widget snippets from the application widget folder.
Default widget folder:
APPLICATION_PATH/widgets/
Each widget is a .php file (for example widgets/stats.php).
use Pair\Html\Widget;
$widget = new Widget('stats');
$html = $widget->render();Sets widget name (file without extension).
Loads APPLICATION_PATH/widgets/<name>.php and returns rendered HTML.
If file is missing, throws PairException with ErrorCodes::WIDGET_NOT_FOUND.
Returns list of available widget names by scanning widget folder.
$list = Widget::availableWidgets();- Widget rendering is output-buffer based (
ob_start+require). - Widget file has access to currently available PHP scope at render time.
See also: View, Application, Classes-folder.