Configurations

All configuration files in SigmaPHP are stored inside the config/ directory located at the project root. The configuration system is intentionally simple and predictable — no hidden magic, just clean PHP arrays that you can fully control.

The framework ships with two main configuration categories: application configuration and database configuration. You are also free to create your own configuration files and access them using SigmaPHP's dot notation helper.

Configuration values can be linked directly to environment variables using the env() helper, allowing different setups for development, staging, or production environments.

Configuration Basics

Application Configuration

The application configuration defines global settings such as project identity, directory structure, routing behavior, and runtime environment.

name

Defines the application display name. This value is commonly used in templates, emails, logs, and system messages.

url

The main application URL. It can be used when generating absolute links, API calls, redirects, or external HTTP integrations.

env

Determines the current running environment such as production, develop, or testing. This allows environment-specific behavior like debugging or caching.

port

Defines the port number the application listens on for incoming requests. Defaults to 8888 if not specified in the environment.

timezone

Sets the default timezone used for all date and time operations. Defaults to UTC if not specified in the environment.

controllers_path

Specifies where controller classes are stored. SigmaPHP automatically loads controllers from this directory.

routes_path

Defines the location of route definition files. Organizing routes in a dedicated directory keeps application structure clean and maintainable.

views_path

Points to the directory containing template/view files rendered by the template engine.

cache_path

Location where compiled templates and cached files are stored to improve performance.

upload_path

Directory used to store uploaded files such as images, documents, or user assets.

allow_http_method_override

Enables HTTP method overriding, allowing forms to simulate methods like PUT, PATCH, or DELETE even when browsers only support POST requests.

static_assets_route

Defines the route prefix used to serve static assets such as CSS, JavaScript, and images through the framework.

base_path

Used only when the application runs inside a sub-directory instead of the domain root. This helps SigmaPHP correctly generate internal URLs. Leave empty when the application is served from the root.

Database Configuration

Database configuration controls migrations, seeders, models, and connection credentials. These settings allow SigmaPHP's ORM and CLI tools to operate consistently across environments.

path_to_migrations

Defines where migration files are stored. Migrations manage database schema changes in a structured and versioned way.

path_to_seeders

Directory containing seed classes used to populate the database with initial or testing data.

path_to_models

Specifies the location of application models used by the ORM layer.

logs_table_name

Name of the table used to track executed migrations and database history. This prevents migrations from running multiple times.

database_connection

Contains the database credentials required to establish a connection. Each value can be overridden using environment variables.

Environment Files (.env)

SigmaPHP reads environment variables from a .env file. You may create multiple versions such as .env.dev, .env.staging, or .env.production to match your deployment workflow.

Values defined inside environment files can be accessed anywhere using the env() helper, while application configuration values are retrieved using the config() helper.

Back to top