API Reference - URW-CE-IT/veloframe GitHub Wiki

API Reference

This page documents the most important classes and methods in VeloFrame.


Server

  • __construct($proj_dir = null): Initialize the server with the project directory.
  • setRoutingHandler($rh): Attach a routing handler.
  • getRoutingHandler(): Get the current routing handler.
  • serve(): Handle the current request.

RoutingHandler

  • register($uri, $handler): Map a URI to a controller.
  • handle($path): Dispatch a request to the correct controller.

DefaultPageController / RequestHandler

  • Base classes for your controllers. Implement request handling logic here.

Template

  • __construct($template_name = null): Load a template by name.
  • open($template_name): Load a new template.
  • includeTemplate($name, $template): Insert a sub-template.
  • setVariable($name, $value): Set a variable for substitution.
  • setComponent($name, $component): Insert a component.
  • output($var_default = ""): Render the template to HTML.

TemplateComponent

  • __construct($component_name, ...$args): Load a component and set variables.
  • setVars(...$args): Set variables by order.
  • setVariable($name, $value): Set a variable by name.
  • output($var_default = ""): Render the component to HTML.

For more, see the source code in VeloFrame/ or Architecture.