Application class is the main entry point for LibreDTE Core. It extends MicroKernel and provides access to the dependency injection container, package registry, and services.
Class Definition
Singleton Pattern
The Application class implements a singleton pattern for simple usage scenarios. However, when using dependency injection containers, it’s recommended to register the application in your DI container instead of using the singleton.getInstance()
Get or create the singleton instance of the application.The environment name or environment interface instance. Common values are
'dev', 'prod', or 'test'.Whether to enable debug mode. When enabled, provides detailed error messages and logging.
The singleton instance of the Application class.
When using dependency injection and registering the LibreDTE application in a DI container, it’s not necessary or recommended to use this method. Use your DI container to obtain the application instance instead.
Example
Public Methods
getPackageRegistry()
Get the package registry containing all available LibreDTE packages.The package registry instance containing access to all LibreDTE packages (billing, etc.).
Example
getService()
Retrieve a service from the dependency injection container by its ID.The service identifier registered in the DI container.
The requested service instance from the container.
Example
Configuration
The Application class automatically loads configuration from:config/services.yaml- Service definitions and parameters
ServiceProcessingCompilerPass- Processes services with thelibredte.lib.prefixServiceConfigurationCompilerPass- Handles service configuration with thelibredte.lib.prefix