AppFactory
in package
Table of Contents
- create() : App
- Static factory method for backward compatibility and convenience.
- createWithDependencies() : App
- Advanced factory method with full control over dependencies.
Methods
create()
Static factory method for backward compatibility and convenience.
public
static create(string $appDirPath[, null|string $environment = null ][, null|ServerRequestInterface $request = null ]) : App
Parameters
- $appDirPath : string
-
The directory path for the application.
- $environment : null|string = null
-
The environment setting, e.g., 'development', 'production'.
- $request : null|ServerRequestInterface = null
-
Optional server request
Return values
App —An initialized App instance.
createWithDependencies()
Advanced factory method with full control over dependencies.
public
static createWithDependencies(string $appDirPath[, null|string $environment = null ][, null|ServerRequestInterface $request = null ][, null|ClientIpResolver $ipResolver = null ][, null|Tenant $tenantResolver = null ][, null|HostManager $httpFactory = null ][, null|ConstantBuilder $builder = null ]) : App
This method provides complete control over all dependencies used during application initialization, allowing for custom implementations and testing scenarios.
Parameters
- $appDirPath : string
-
The directory path for the application
- $environment : null|string = null
-
The environment setting, e.g., 'development', 'production'
- $request : null|ServerRequestInterface = null
-
Optional server request instance
- $ipResolver : null|ClientIpResolver = null
-
Optional custom IP resolver for client IP detection
- $tenantResolver : null|Tenant = null
-
Optional custom tenant resolver for multi-tenant applications
- $httpFactory : null|HostManager = null
-
Optional custom HTTP factory for host management
- $builder : null|ConstantBuilder = null
-
Optional custom constant builder for application constants
Return values
App —An initialized App instance with the specified dependencies