Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AngelZurita28/VeranoRegional/llms.txt

Use this file to discover all available pages before exploring further.

Verano Regional reads all sensitive settings — database credentials, SMTP details, and debug flags — from a .env file in the project root. The EnvLoader helper parses this file at startup and exposes each key through PHP’s $_ENV and $_SERVER superglobals, as well as getenv(). No framework-level configuration layer is involved.

.env file

Create a .env file in the project root before starting the server. A minimal working configuration looks like this:
DB_HOST=localhost
DB_NAME=verano
DB_USER=root
DB_PASS=your_password

SMTP_HOST=smtp.example.com
SMTP_USER=no-reply@example.com
SMTP_PASS=your_smtp_password
SMTP_PORT=587
SMTP_FROM_EMAIL=no-reply@example.com
SMTP_FROM_NAME=Verano De La Ciencia de la Region Centro
Never commit .env to version control. The repository’s .gitignore already excludes it, but verify this before pushing to a shared remote.

Variable reference

VariableRequiredDescription
DB_HOSTYesMySQL hostname
DB_NAMEYesDatabase name (default: verano)
DB_USERYesMySQL username
DB_PASSYesMySQL password
SMTP_HOSTYes (email)SMTP server hostname
SMTP_USERYes (email)SMTP login username
SMTP_PASSYes (email)SMTP login password
SMTP_PORTNoSMTP port — 587 (STARTTLS) or 465 (SSL). Defaults to 587
SMTP_FROM_EMAILNoSender address. Defaults to SMTP_USER
SMTP_FROM_NAMENoSender display name

EnvLoader

helpers/EnvLoader.php provides a single static method that reads the .env file line by line, skips blank lines and comments, and injects each key-value pair into the PHP environment — but only if the variable is not already set by the OS or web server, preventing accidental overrides.
class EnvLoader
{
    public static function load($path)
    {
        if (!file_exists($path)) {
            return;
        }

        $lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        foreach ($lines as $line) {
            if (strpos(trim($line), '#') === 0) {
                continue; // skip comments
            }
            list($name, $value) = explode('=', $line, 2);
            $name  = trim($name);
            $value = trim(trim($value), '"\'');

            if (!array_key_exists($name, $_SERVER) && !array_key_exists($name, $_ENV)) {
                putenv(sprintf('%s=%s', $name, $value));
                $_ENV[$name]    = $value;
                $_SERVER[$name] = $value;
            }
        }
    }
}
index.php calls this once before any controller is loaded:
require_once __DIR__ . '/helpers/EnvLoader.php';
EnvLoader::load(__DIR__ . '/.env');

Database connection

config/conn.php defines the Database class. The connection credentials are currently hard-coded as class properties — update them directly to match your local MySQL setup, or replace them with $_ENV reads after EnvLoader runs.
class Database
{
    private $host     = 'localhost';
    private $db_name  = 'verano';
    private $username = 'root';
    private $password = 'root';

    public function connect()
    {
        $this->conn = new PDO(
            'mysql:host=' . $this->host
                . ';dbname=' . $this->db_name
                . ';charset=utf8mb4',
            $this->username,
            $this->password,
            [
                PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
                PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4",
            ]
        );
        return $this->conn;
    }
}
The connection uses PDO::ERRMODE_EXCEPTION so database errors throw catchable PDOException instances rather than returning silent failures. The utf8mb4 charset ensures full Unicode support, including emoji and non-Latin scripts.
The Database class also exposes higher-level helper methods — Select(), Insert(), Update(), Delete() — used by some model code. Newer models receive the raw PDO connection object from connect() and use prepared statements directly.

Required PHP extensions

The database layer requires the following PHP extensions to be enabled:
  • pdo — base PDO library
  • pdo_mysql — MySQL driver for PDO
Verify they are active with php -m | grep -i pdo before running the application.

Email configuration

OTP emails during registration and password reset are sent via PHPMailer (bundled in helpers/PHPMailer/). The EmailHelper class reads SMTP settings from $_ENV at send time:
$mail->Host       = $_ENV['SMTP_HOST'] ?? 'smtp.gmail.com';
$mail->Username   = $_ENV['SMTP_USER'] ?? '';
$mail->Password   = $_ENV['SMTP_PASS'] ?? '';
$mail->Port       = $_ENV['SMTP_PORT'] ?? 587;
// Port 465 → implicit SSL; all others → STARTTLS
$mail->SMTPSecure = ($port == 465)
    ? PHPMailer::ENCRYPTION_SMTPS
    : PHPMailer::ENCRYPTION_STARTTLS;
To send email in production, populate all SMTP_* variables in .env. For local development you can use a mail-catching tool such as Mailpit or Mailtrap by pointing SMTP_HOST, SMTP_USER, and SMTP_PORT at the local catcher.

Debug mode

RegisterController includes a $debugMode flag that bypasses live OTP generation and email delivery during development:
private $debugMode = false;
Set it to true to use the static OTP 000000 for all email-verification flows. This lets you complete the registration process without a working SMTP server.
Never deploy with $debugMode = true. The static OTP 000000 means anyone can verify any email address, bypassing the entire verification flow.
For a safer development workflow, leave $debugMode = false and use a local SMTP catcher instead. This keeps your code identical to production and avoids accidentally shipping debug code.

Build docs developers (and LLMs) love