logo

Documentation: Project Classes

Your project classes MUST be located in src folder and use Lucinda\Project\... namespaces in order to be autoloaded. Folder structure:

Cacheables

Folder contains classes binding HTTP Headers API and STDOUT MVC API in order to generate ETag/Last-Modified representation of response body for HTTP caching. Framework Skeleton API comes with following:

All classes inside:

  1. require a tag in .xml with a cacheable attribute pointing to one of classes here
  2. must extend
  3. require registering in index.php
  4. require registering in index.php after above

Controllers

Folder contains STDOUT MVC API, Console MVC API as well as STDERR MVC API controllers. Framework Skeleton API only comes with following:

All classes inside:

To learn more how to register and use controllers, check Tutorial!

DAO

Folder contains all classes encapsulating communication to SQL/NoSQL databases via Entity/DAO model without automated persistance (ORM = performance disaster). Framework Skeleton API only comes with following:

Framework Configurer API comes with a number of demo implementations of Web Security API prototypes for authentication and authorization that may be deployed here but developers can create their own, provided their class extends/implements required prototype:

XML Tag Tag Attribute Class Prototype
<form> @ dao
<oauth2> @ dao
<by_dao> @ page_dao
<by_dao> @ user_dao

All classes inside:

  1. must ONLY encapsulate operations with databases: querying and processing. Developers MUST NOT perform DB logic outside this area!
  2. if your project requires authentication and authorization, Web Security API integration is needed:
  3. if they require work with SQL databases (eg: MySQL), SQL Data Access API integration is needed:
  4. if they require work with NoSQL databases (eg: Redis), NoSQL Data Access API integration is needed:

To learn more how to model classes here using Entity-DAO model without ORM, check Tutorial!

Error Reporters

Folder contains all classes used by STDERR MVC API to report errors into a storage medium. Framework Skeleton API binds it with Logging API and comes with following:

All classes inside:

  1. require setting up a tag in stderr.xml with one or more <reporter> subtags per ENVIRONMENT, each holding a class attribute pointing to one of classes here
  2. must extend

To learn more how to register or create error reporters, check Tutorial!

Event Listeners

To learn more how to register, create and use loggers, check Tutorial!

Handled by STDOUT MVC API

STDOUT MVC API also allows you to manually integrate APIs or user code through event listeners in index.php file via addEventListener method. Framework Skeleton API comes with following (please keep in mind they are ran in the order they are set once respective lifecycle event is reached):

Logical schema:

Handled by Console MVC API

Console MVC API also allows you to manually integrate APIs or user code through event listeners in index.php file via addEventListener method. Framework Skeleton API comes with following (please keep in mind they are ran in the order they are set once respective lifecycle event is reached):

Logical schema:

Loggers

Folder contains classes binding Logging API and STDOUT MVC API / Console MVC API in order to write log messages to a storage medium. Framework Skeleton API comes with following:

All classes inside:

  1. require setting up a tag in stdout.xml with one or more <logger> subtags per ENVIRONMENT, each holding a class attribute pointing to one of classes here
  2. must extend
  3. require registering in index.php

ParameterValidators

Folder contains classes using STDOUT MVC API to validate request (GET, POST) or path parameters. Framework Skeleton API comes with none (because their logic depends on project) but all projects will require it eventually.

All classes inside:

  1. require setting up a tag in stdout.xml with a <parameter> tag for each parameter to validate binding its name to a class attribute pointing to one of classes here
  2. must implement

To learn more how to work with parameter validators, check Tutorial!

View Resolvers

Folder contains classes used by STDOUT MVC API, Console MVC API as well as STDERR MVC API to resolve views based on response format. Framework Skeleton API comes with following:

All classes inside:

  1. require a tag in stdout.xml with <resolver> subtag with unique format attribute (eg: json) and a class attribute pointing to one of classes here
  2. require a tag in stdout.xml, if is used
  3. must extend

To learn more how to register or create view resolvers, check Tutorial!

Attributes

While STDOUT MVC API or Console MVC API handle requests into responses, some information saved by a component (via setters) may need to be made available to subsequent components (via getters). This is done via or that need to be extended by frameworks or developers to handle more functionality.

Handled by STDOUT MVC API

Framework extends with in order to collect information provided by its own event listeners, which adds following extra getters:

Method Returns Description Setter
getLogger
NULL
Gets class to log messages with
getUserId string
integer
null
Gets logged in user id
getCsrfToken string
NULL
Gets token to send as 'csrf' POST param when logging in by form
getAccessToken string
NULL
Gets token to be remembered and presented by client for stateless authentication as 'Authorization' header
getHeaders
NULL
Gets class to use in reading request headers received and writing response headers

As developers are creating their own event listeners, they need to modify this class (found in src folder) and add setters&getters for any information they want to put in transport layer.

Handled by Console MVC API

Framework extends with in order to collect information provided by its own event listeners, which adds following extra getters:

Method Returns Description Setter
getLogger
NULL
Gets class to log messages with

As developers are creating their own event listeners, they need to modify this class (found in src folder) and add setters&getters for any information they want to put in transport layer.

EmergencyHandler

is used to process any errors that happen while STDERR MVC API handles exceptions into response. It reads stderr.xml and produces a status 500 response using with debug information (if is on for current ENVIRONMENT)!

Please note that Framework Skeleton API only bundles html, json and console response format support. For other formats you may need to modify this class!
×