VOOZH about

URL: https://deepwiki.com/hypervel/testbench/6.2-application-configuration

⇱ Application Configuration | hypervel/testbench | DeepWiki


Loading...
Last indexed: 7 February 2026 (93289f)
Menu

Application Configuration

Purpose and Scope

This page documents the workbench/config/app.php configuration file, which defines core application settings for the Hypervel Testbench environment. This includes application metadata, debug settings, annotation scanning, logging levels, localization, and the default service providers and aliases.

For broader configuration management concepts, see Configuration Management. For testbench-specific YAML configuration, see Testbench Configuration (testbench.yaml). For other configuration files like database and session settings, see Database Configuration and Session, CORS, and Security Configuration.

Configuration File Structure

The workbench/config/app.php file returns a PHP array containing application-level settings. Most values support environment variable overrides via the env() helper function, allowing configuration customization without modifying code.

Configuration File Location Diagram


Sources: workbench/config/app.php1-127

Application Metadata Settings

The configuration file defines fundamental application identity and behavior settings:

Configuration KeyDefault ValueEnvironment VariableDescription
name'Hypervel'APP_NAMEApplication name used in notifications and display
env'dev'APP_ENVCurrent environment (dev, production, testing)
debugtrueAPP_DEBUGDebug mode toggle for detailed error messages
url'http://localhost'APP_URLBase URL for console-generated URLs

Sources: workbench/config/app.php21-93

Application Name


The application name is used by the framework when placing the application's name in notifications, emails, or any other location required by the application or its packages. This value is retrieved from the APP_NAME environment variable or defaults to 'Hypervel'.

Sources: workbench/config/app.php21

Application Environment


The environment setting determines which configuration profile the application uses. Common values include dev, production, and testing. This affects service configuration, error handling behavior, and optimization settings. The testbench typically uses dev or testing environments.

Sources: workbench/config/app.php34

Debug Mode


When debug is enabled, the application displays detailed error messages with stack traces. When disabled, generic error pages are shown. The testbench defaults to true to aid in test development, though production applications should set this to false.

Sources: workbench/config/app.php48

Application URL


The base URL is used by console commands when generating URLs. This is particularly important for testing URL generation logic, email links, and other features that require absolute URLs.

Sources: workbench/config/app.php93

Annotation Scanning Configuration

Hyperf uses annotation scanning to discover components like controllers, middleware, and listeners. The scan_cacheable flag controls whether scanning results are cached:






















ValueBehaviorUse Case
falseRe-scan on every requestDevelopment and testing
trueCache scan resultsProduction deployments

The testbench defaults to false to ensure changes during test development are immediately reflected. Enabling caching can significantly improve framework initialization performance but should only be used when code is stable.

Sources: workbench/config/app.php60

Logging Configuration

StdoutLogger Levels

The stdout_log_level configuration determines which log levels are written to standard output by the StdoutLogger:


Log Level Configuration Diagram


Note that LogLevel::DEBUG is commented out by default, preventing verbose debug messages from cluttering test output. This configuration only affects the stdout logger; other configured loggers may use different level settings.

Sources: workbench/config/app.php71-80 Psr\Log\LogLevel

Localization Settings

The configuration provides timezone and locale settings for the application:

Timezone


The default timezone is used by PHP date and date-time functions throughout the application. The testbench defaults to UTC for consistency in test execution across different server environments.

Sources: workbench/config/app.php106

Locale Configuration



















Configuration KeyPurpose
localeDefault locale for translation service
fallback_localeFallback locale when translations are missing

Both settings support environment variable customization, allowing tests to verify localization behavior across different locales.

Sources: workbench/config/app.php119-121

Service Providers and Aliases

The configuration registers default service providers and facade aliases for the application:

Service Providers


This calls ServiceProvider::defaultProviders() from the Hypervel framework, which returns a collection of default service providers. These providers are automatically registered during application bootstrapping.

Provider Registration Flow


The actual provider registration is augmented by ConfigProviderRegister, which maintains a static registry of 45+ configuration providers from both Hyperf and Hypervel ecosystems. See Configuration Provider System for details on how providers are managed.

Sources: workbench/config/app.php123 src/ConfigProviderRegister.php11-57

Facade Aliases


This calls Facade::defaultAliases() from Hypervel, which returns a collection of default facade class aliases. Facades provide a static interface to services registered in the application container.

Sources: workbench/config/app.php125

Configuration Value Resolution

The app.php configuration demonstrates a consistent pattern for environment variable usage:

Environment Variable Resolution Pattern


The env() helper function checks for environment variables defined in the .env file, which is generated from testbench.yaml during bootstrap. If a variable is not defined, it falls back to the provided default value.

Common Environment Variables in app.php:

VariablePurposeDefault
APP_NAMEApplication name'Hypervel'
APP_ENVEnvironment'dev'
APP_DEBUGDebug modetrue
APP_URLBase URL'http://localhost'
APP_TIMEZONETimezone'UTC'
APP_LOCALEDefault locale'en'
APP_FALLBACK_LOCALEFallback locale'en'
SCAN_CACHEABLECache annotationsfalse

Sources: workbench/config/app.php21-121

Integration with Testbench Lifecycle

The app.php configuration is loaded during the application creation phase of the test lifecycle:

Configuration Loading in Test Lifecycle


The configuration is loaded during each createApplication() call in the test setup phase, ensuring a fresh configuration for each test. The defineEnvironment() hook in test classes can modify these values before the application is fully initialized.

Sources: workbench/config/app.php1-127 see also Application Creation and Container Setup

Customizing Configuration in Tests

Test classes can override configuration values using the defineEnvironment() method:


This method is called after configuration files are loaded but before the application is fully initialized, allowing tests to customize settings on a per-test or per-class basis.

Sources: See Reloading and Environment Management for details on defineEnvironment() usage.

Summary

The workbench/config/app.php file provides essential application-level configuration:

  • Metadata: Application name, environment, and URL
  • Behavior: Debug mode and annotation caching
  • Logging: StdoutLogger level configuration
  • Localization: Timezone and locale settings
  • Architecture: Service provider and facade alias registration

All major settings support environment variable overrides, allowing flexible configuration without code changes. The configuration integrates with the testbench bootstrap process and can be customized per-test using the defineEnvironment() hook.

Sources: workbench/config/app.php1-127