Db
extends PDO
in package
Class Db
- Database Connection Wrapper.
- Implements the Singleton Pattern to ensure a single active database connection per request.
- Extends PDO to provide direct access to database methods.
Table of Contents
Properties
Methods
- getInstance() : self
- Returns the single instance of the Database connection.
- __construct() : mixed
- Private constructor to prevent direct instantiation.
Properties
$instance
private
static Db|null
$instance
The single instance of the class.
Methods
getInstance()
Returns the single instance of the Database connection.
public
static getInstance() : self
Return values
self__construct()
Private constructor to prevent direct instantiation.
private
__construct() : mixed
Establishes the PDO connection using environment variables.