Skip to content

Initialization Lifecycle

The Raydium Framework is designed to enhance the WordPress development experience by providing a structured, secure, and scalable environment. Its initialization lifecycle is crucial for setting up the application's environment, ensuring compatibility with WordPress, and facilitating optional multi-tenant configurations. This documentation outlines the steps involved in the initialization lifecycle of the Raydium Framework and its integration with WordPress.

Pre-Initialization and Environment Setup

Constants Definition

The initialization process begins with the definition of essential constants that outline the foundational paths and configurations for the application. These include:

  • SITE_CONFIGS_DIR: Specifies the directory for site configurations.
  • APP_DIR_PATH: Defines the base directory path of the application.
  • APP_HTTP_HOST: Captures the current HTTP host information.

This early setup phase is critical for laying the groundwork for subsequent environment-specific configurations.

Environment Configuration

Raydium identifies the supported .env environment file names and filters out non-existent files to streamline the environment configuration process. This step ensures that only existing environment files are considered for loading environment variables.

Environment Variables Loading

Raydium then attempts to load the environment variables essential for the application's configuration. In cases where the required .env files are missing, the framework tries to regenerate these files and reload the variables.

Error Handling and Termination

If critical environment files are missing or cannot be regenerated, Raydium terminates the initialization process. An appropriate error message is displayed, indicating the nature of the issue and preventing further execution.

Multi-Tenancy Support

Tenancy Component Initialization

For applications with multi-tenant configurations, Raydium initializes the Tenancy component. This component dynamically adjusts the environment based on tenant-specific settings and validates tenant domains.

Multi-Tenancy Error Management

Errors related to multi-tenancy, such as missing environment variables or unrecognized tenant domains, result in the termination of the initialization process. Detailed error information is provided to facilitate troubleshooting.

Application Kernel Initialization

Core Application Setup

Upon successful environment and multi-tenancy setup, Raydium proceeds to instantiate the application kernel. This involves creating an App instance configured with the application path, configuration directory, and options (app.php) file.

Kernel Handoff

The initialized application kernel represents the core of the Raydium application, ready to hand-off to WordPress and manages the application's lifecycle.

Error Management and Graceful Termination

Throughout the initialization lifecycle, Raydium is equipped to handle exceptions gracefully. Any encountered exceptions trigger a structured termination process, ensuring that the execution halts with clear and informative error reporting.

Handoff to WordPress

With the application kernel successfully initialized, Raydium completes its setup phase. Control is then handed off to WordPress, allowing it to leverage the configured environment and enhancements provided by the Raydium Framework.

The Raydium Framework's initialization lifecycle is engineered to provide a seamless, secure, and scalable foundation for WordPress development. By following these structured steps, Raydium ensures that WordPress applications are well-configured, enhancing the overall development and deployment experience.