Documentation

Application
in package

Application - Main Container (Singleton)

This class is the main entry point of the application. It initializes and provides access to all core services.

Pattern: Singleton (Service Locator)

This class implements the Singleton pattern to ensure a single instance manages all core services throughout the application lifecycle. It provides centralized access to:

  • Session management
  • HTTP request/response handling
  • CSRF protection
  • Authentication/authorization
Tags
author

BDELIVE - Groupe 8

version
3.6.8

Table of Contents

Properties

$auth  : AuthManager
$csrf  : CsrfProtection
$instance  : Application|null
$request  : Request
$response  : Response
$session  : SessionManager

Methods

__wakeup()  : void
Prevent unserialization (Singleton pattern)
auth()  : AuthManager
Get the authentication manager
boot()  : void
Boot the application
csrf()  : CsrfProtection
Get the CSRF protection service
getInstance()  : self
Get the singleton instance of the application
request()  : Request
Get the HTTP request instance
response()  : Response
Get the HTTP response instance
session()  : SessionManager
Get the session manager instance
__clone()  : void
Prevent cloning (Singleton pattern)
__construct()  : mixed
Private constructor (Singleton pattern)

Properties

Methods

__wakeup()

Prevent unserialization (Singleton pattern)

public __wakeup() : void
Tags
throws
Exception

Always throws to prevent unserialization

auth()

Get the authentication manager

public auth() : AuthManager

Handles user login, logout, and permission checks.

Return values
AuthManager

The authentication manager

boot()

Boot the application

public boot() : void

Starts the session and prepares the environment for request handling. Must be called once at application startup before processing requests.

csrf()

Get the CSRF protection service

public csrf() : CsrfProtection

Provides token generation, validation, and HTML field generation.

Return values
CsrfProtection

The CSRF protection service

getInstance()

Get the singleton instance of the application

public static getInstance() : self

Creates the instance on first call, then returns the same instance.

Return values
self

The unique Application instance

request()

Get the HTTP request instance

public request() : Request

Provides access to GET/POST/SERVER data in an OOP manner.

Return values
Request

The current HTTP request with encapsulated superglobals

response()

Get the HTTP response instance

public response() : Response

Provides methods for redirects, headers, and status codes.

Return values
Response

The response handler for HTTP output

session()

Get the session manager instance

public session() : SessionManager

Provides access to session operations like get/set/flash messages.

Return values
SessionManager

The session manager for handling $_SESSION

__clone()

Prevent cloning (Singleton pattern)

private __clone() : void
Tags
throws
Error

Always throws to prevent cloning

__construct()

Private constructor (Singleton pattern)

private __construct() : mixed

Initializes all core services in dependency order:

  1. SessionManager - for session handling
  2. Request - HTTP request encapsulation
  3. Response - HTTP response management
  4. CsrfProtection - CSRF token handling (depends on SessionManager)
  5. AuthManager - Authentication/authorization (depends on SessionManager)

        
On this page

Search results