Framework Skeleton API: Reference Guide

Table of contents:

DateCacheableDriver

CacheableDriver that generates a last modified time based on host, response body & headers. Useful when app is behind proxies that hide ETAGs. Requires a NoSQL provider to save generated last modified time into.

Signature

class DateCacheableDriver extends \Lucinda\Framework\CacheableDriver

Methods

Method Arguments Returns Description
setTime Sets value of last modified time of requested resource . This method is:
setEtag Sets value of etag matching requested resource . This method is:

EmergencyHandler

Error handler that prevents STDERR MVC FrontController handling its own errors. Developers may need to modify contents of handle method to give more or less information about bug encountered.

Signature

class EmergencyHandler implements \Lucinda\MVC\STDERR\ErrorHandler

Methods

Method Arguments Returns Description
handle \Exception $exception Handles errors by delegating to registered storage mediums (if any) then output using display method (if any) . This method is:

ErrorListener

Binds STDERR MVC with Logging API in order to render response in same content type as current page

Signature

class ErrorListener extends \Lucinda\MVC\STDOUT\RequestListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

ErrorsController

STDERR MVC controller that gets activated whenever an error occurs during application lifecycle. Class is open for modification if developers want to use templating on response body or support formats other than html and json.

Signature

class ErrorsController extends \Lucinda\MVC\STDERR\Controller

Methods

Method Arguments Returns Description
run Executes controller logic. Here is where each extending controller will need to write its logic to. . This method is:

EtagCacheableDriver

CacheableDriver that generates an ETAG based on host, response body & headers.

Signature

class EtagCacheableDriver extends \Lucinda\Framework\CacheableDriver

Methods

Method Arguments Returns Description
setTime Sets value of last modified time of requested resource . This method is:
setEtag Sets value of etag matching requested resource . This method is:

FileLoggerWrapper

Logs message into file on disk, whose location varies according to development environment. ATTENTION: web server must have write access on folder file is located into!

Signature

class FileLoggerWrapper extends \Lucinda\Framework\AbstractLoggerWrapper

Methods

Method Arguments Returns Description
setLogger \SimpleXMLElement $xml \Lucinda\Logging\Logger Detects Logger instance based on XML tag supplied . This method is:

FileReporter

Logs error into file on disk, whose location varies according to development environment. ATTENTION: web server must have write access on folder file is located into!

Signature

class FileReporter extends \Lucinda\Framework\LogReporter

Methods

Method Arguments Returns Description
getLogger \SimpleXMLElement $xml \Lucinda\Logging\Logger Detects logger based on XML attributes. . This method is:

HtmlRenderer

STDERR MVC error renderer for HTML format.

Signature

class HtmlRenderer implements \Lucinda\MVC\STDERR\ErrorRenderer

Methods

Method Arguments Returns Description
render \Lucinda\MVC\STDERR\Response $response Renders response to screen. . This method is:

HtmlResolver

View resolver for HTML response format to be used whenever developers do not desire HTML templating (NOT RECOMMENDED!)

Signature

class HtmlResolver extends \Lucinda\MVC\STDOUT\ViewResolver

Methods

Method Arguments Returns Description
getContent mixed Gets view content to write to output stream . This method is:

HttpCachingListener

Binds STDOUT MVC with Http Caching API and contents of 'http_caching' tag @ configuration.xml in order to answer with just a 304 Not Modified header later on if view hasn't changed.

Signature

class HttpCachingListener extends \Lucinda\MVC\STDOUT\ResponseListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

Json

Simple wrapper over json functionality.

Signature

class Json

Methods

Method Arguments Returns Description
encode mixed $data string Encodes data into JSON format. . This method is:
  • throwing JsonException If encoding of mixed data into json failed
decode string $json,
boolean $assoc
mixed Decodes JSON into original php data type. . This method is:

JsonException

Encapsulates errors in json manipulation.

Signature

class JsonException extends \Exception

JsonRenderer

STDERR MVC error renderer for JSON format.

Signature

class JsonRenderer implements \Lucinda\MVC\STDERR\ErrorRenderer

Methods

Method Arguments Returns Description
render \Lucinda\MVC\STDERR\Response $response Renders response to screen. . This method is:

JsonResolver

View resolver for JSON response format

Signature

class JsonResolver extends \Lucinda\MVC\STDOUT\ViewResolver

Methods

Method Arguments Returns Description
getContent mixed Gets view content to write to output stream . This method is:

LocalizationListener

Binds STDOUT MVC with Internationalization API and contents of 'internationalization' tag @ configuration.xml in order to be able to render a view according to client locale.

Signature

class LocalizationListener extends \Lucinda\MVC\STDOUT\RequestListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

LoggingListener

Binds STDOUT MVC with Logging API and contents of 'loggers' tag @ configuration.xml based on development environment in order for developers to be able to log a message to a provider (eg: syslog). Sets attributes:

Signature

class LoggingListener extends \Lucinda\MVC\STDOUT\ApplicationListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

MethodNotAllowedException

Exception thrown when HTTP method is not allowed by a REST controller.

Signature

class MethodNotAllowedException extends Exception

NoSQLDataSourceInjector

Binds STDOUT MVC with NoSQL Data Access API and contents of 'nosql' subtag of 'servers' tag @ configuration.xml in order to be able to operate with a nosql database (supported: memcache(d), apc(u), redis, couchbase). Sets up and injects a Lucinda\NoSQL\DataSource object that will be used automatically when querying database via Lucinda\NoSQL\ConnectionSingleton or Lucinda\NoSQL\ConnectionFactory.

Signature

class NoSQLDataSourceInjector extends \Lucinda\MVC\STDOUT\ApplicationListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

RestController

Defines an abstract RESTful controller. Classes extending it must have methods whose name is identical to request methods they are expecting.

Signature

abstract class RestController extends \Lucinda\MVC\STDOUT\Controller

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

SQLDataSourceInjector

Binds STDOUT MVC with SQL Data Access API and contents of 'sql' subtag of 'servers' tag @ configuration.xml in order to be able to operate with a sql database (via PDO). Sets up and injects a Lucinda\SQL\DataSource object that will be used automatically when querying database via Lucinda\SQL\ConnectionSingleton or Lucinda\SQL\ConnectionFactory.

Signature

class SQLDataSourceInjector extends \Lucinda\MVC\STDOUT\ApplicationListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

SecurityListener

Binds STDOUT MVC API with Web Security API + OAuth2 Client API and contents of 'security' tag @ configuration.xml in order to be able to perform web security operations (authentication/authorization) to a request. Sets attributes:

Signature

class SecurityListener extends \Lucinda\MVC\STDOUT\RequestListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

SecurityPacketController

STDERR MVC controller running whenever a Lucinda\Framework\SecurityPacket is thrown during STDOUT phase. Class is open for modification if, for example, developers want to simply redirect to callback page when HTML response format is required instead of showing 401/403/404 views.

Signature

class SecurityPacketController extends \Lucinda\MVC\STDERR\Controller

Methods

Method Arguments Returns Description
run Executes controller logic. Here is where each extending controller will need to write its logic to. . This method is:

SysLoggerWrapper

Logs message into a dedicated SYSLOG server, whose details may vary according to development environment.

Signature

class SysLoggerWrapper extends \Lucinda\Framework\AbstractLoggerWrapper

Methods

Method Arguments Returns Description
setLogger \SimpleXMLElement $xml \Lucinda\Logging\Logger Detects Logger instance based on XML tag supplied . This method is:

SyslogReporter

Logs error into a dedicated SYSLOG server, whose details may vary according to development environment.

Signature

class SyslogReporter extends \Lucinda\Framework\LogReporter

Methods

Method Arguments Returns Description
getLogger \SimpleXMLElement $xml \Lucinda\Logging\Logger Detects logger based on XML attributes. . This method is:

ValidationListener

Binds STDOUT MVC API with Parameters Validation API based on contents of <routes> stdout.xml tag for request/path parameters validation. Sets attribute:

Signature

class ValidationListener extends \Lucinda\MVC\STDOUT\RequestListener

Methods

Method Arguments Returns Description
run Executes logic of a Runnable . This method is:

ViewLanguageRenderer

STDERR MVC error renderer for HTML format using ViewLanguage templating.

Signature

class ViewLanguageRenderer implements \Lucinda\MVC\STDERR\ErrorRenderer

Methods

Method Arguments Returns Description
render \Lucinda\MVC\STDERR\Response $response Renders response to screen. . This method is:

ViewLanguageResolver

View resolver for HTML format binding STDOUT MVC with View Language API and contents of 'application' tag @ configuration.xml in order to be able to perform templating in a view

Signature

class ViewLanguageResolver extends \Lucinda\MVC\STDOUT\ViewResolver

Methods

Method Arguments Returns Description
getContent mixed Gets view content to write to output stream . This method is:

FacebookSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Facebook

Signature

class FacebookSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

FacebookUserInformation

Collects information about logged in Facebook user

Signature

class FacebookUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from Facebook.

GitHubSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Github

Signature

class GitHubSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

GitHubUserInformation

Collects information about logged in GitHub user

Signature

class GitHubUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from GitHub.

GoogleSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Google

Signature

class GoogleSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

GoogleUserInformation

Collects information about logged in Google user

Signature

class GoogleUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from Google.

InstagramSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Instagram

Signature

class InstagramSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

InstagramUserInformation

Collects information about logged in Instagram user

Signature

class InstagramUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from Instagram.

LinkedInSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Linkedin

Signature

class LinkedInSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

LinkedInUserInformation

Collects information about logged in LinkedIn user

Signature

class LinkedInUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from LinkedIn.

VKSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for VK

Signature

class VKSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

VKUserInformation

Collects information about logged in VKontakte user

Signature

class VKUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from VKontakte.

YahooSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Yahoo

Signature

class YahooSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

YahooUserInformation

Collects information about logged in Yahoo user

Signature

class YahooUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct array $info Saves logged in user details received from Yahoo.

YandexSecurityDriver

Binds OAuth2\Driver @ OAuth2Client API with OAuth2Driver @ Security API for Yandex

Signature

class YandexSecurityDriver extends \Lucinda\Framework\AbstractSecurityDriver implements \Lucinda\WebSecurity\OAuth2Driver

Methods

Method Arguments Returns Description
getUserInformation string $accessToken \Lucinda\WebSecurity\OAuth2UserInformation Gets remote user information from oauth2 driver via access token. . This method is:
getDefaultScopes string[] Gets authorization code scopes required by login operation. . This method is:

YandexUserInformation

Collects information about logged in Yandex user

Signature

class YandexUserInformation extends AbstractUserInformation

Methods

Method Arguments Returns Description
__construct string[string] $info Saves logged in user details received from Yandex.

BasicLoginThrottler

Basic time based throttler against serial failed login attempts:

Signature

abstract class BasicLoginThrottler extends \Lucinda\Framework\LoginThrottler

Methods

Method Arguments Returns Description
__construct \Lucinda\MVC\STDOUT\Request $request,
string $ipAddress,
string $userName
Registers variables and checks current throttling status for request.
getTimePenalty integer
null
Registers variables and checks current throttling status for request. This method is:
setFailure Marks subsequent login as failed, making client liable for time penalties. This method is:
setSuccess Marks subsequent login as successful, removing any previous failures and penalties. This method is:

SqlLoginThrottler

Extension of BasicLoginThrottler that uses an SQL table as storage medium of login histories with following structure:

CREATE TABLE user_logins ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, ip VARCHAR(45) NOT NULL, username VARCHAR(255) NOT NULL, attempts BIGINT UNSIGNED NOT NULL default 0, penalty_expiration DATETIME DEFAULT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY(id), UNIQUE(ip, username) ) Engine=InnoDB;

Signature

class SqlLoginThrottler extends BasicLoginThrottler

NoSqlLoginThrottler

Extension of BasicLoginThrottler that uses NoSQL documents as storage medium of login histories where keys use following format:

$key = "logins__".sha1(json_encode(array("ip"=>$ipAddress, "username"=>$userName)));

Signature

class NoSqlLoginThrottler extends BasicLoginThrottler

Methods

Method Arguments Returns Description
__construct \Lucinda\MVC\STDOUT\Request $request,
string $ipAddress,
string $userName
Registers variables, calculates document key to look for then checks current throttling status for request. This method is:

Share