VOOZH about

URL: https://deepwiki.com/hypervel/testbench/3-configuration-provider-system

⇱ Configuration Provider System | hypervel/testbench | DeepWiki


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

Configuration Provider System

The ConfigProviderRegister class serves as the central registry for managing configuration providers within the Hypervel Testbench framework. This class maintains a static collection of 45 service providers from both Hyperf and Hypervel frameworks, enabling modular application architecture and ensuring consistent service registration during test execution.

For information about how these providers are used during application bootstrapping, see page 5. For details on configuring which providers are active, see page 6.1.

Class Overview

The ConfigProviderRegister class is a static utility located in src/ConfigProviderRegister.php that manages service provider registration for the testbench environment. It provides methods to retrieve, filter, add, and remove configuration providers that define services, dependencies, and framework components.

Class Structure and API Surface


Sources: src/ConfigProviderRegister.php9-88

System Integration


Sources: src/ConfigProviderRegister.php9-88

Provider Registry Structure

The class maintains a comprehensive list of configuration providers organized by framework. The static $configProviders array contains exactly 45 provider classes that are essential for testbench functionality.

Hyperf Framework Providers (20 Total)

The registry includes 20 core Hyperf providers that handle fundamental framework services:

Provider ClassLinePurpose
Hyperf\Command\ConfigProvider12CLI command system registration
Hyperf\Database\SQLite\ConfigProvider13SQLite database driver support
Hyperf\DbConnection\ConfigProvider14Database connection management
Hyperf\Di\ConfigProvider15Dependency injection container
Hyperf\Dispatcher\ConfigProvider16Event dispatcher system
Hyperf\Engine\ConfigProvider17Swoole coroutine engine integration
Hyperf\Event\ConfigProvider18Event listener registration
Hyperf\ExceptionHandler\ConfigProvider19Exception handling middleware
Hyperf\Framework\ConfigProvider20Core framework bootstrapping
Hyperf\HttpMessage\ConfigProvider21PSR-7 HTTP message implementations
Hyperf\HttpServer\ConfigProvider22HTTP server and routing
Hyperf\Memory\ConfigProvider23Memory table abstractions
Hyperf\ModelListener\ConfigProvider24Eloquent model event listeners
Hyperf\Paginator\ConfigProvider25Database query pagination
Hyperf\Pool\ConfigProvider26Connection pooling infrastructure
Hyperf\Process\ConfigProvider27Process management
Hyperf\Redis\ConfigProvider28Redis client and pooling
Hyperf\Serializer\ConfigProvider29Data serialization handlers
Hyperf\Server\ConfigProvider30Server configuration and lifecycle
Hyperf\Signal\ConfigProvider31Signal handling for process control

Hypervel Framework Providers (25 Total)

The registry includes 25 Hypervel providers that extend Hyperf with Laravel-inspired features:

Provider ClassLinePurpose
Hypervel\ConfigProvider32Base Hypervel framework services
Hypervel\Auth\ConfigProvider33Authentication guards and providers
Hypervel\Broadcasting\ConfigProvider34WebSocket and event broadcasting
Hypervel\Bus\ConfigProvider35Command bus and job dispatching
Hypervel\Cache\ConfigProvider36Cache manager and drivers
Hypervel\Cookie\ConfigProvider37HTTP cookie management
Hypervel\Config\ConfigProvider38Configuration repository
Hypervel\Console\ConfigProvider39Artisan-style console commands
Hypervel\Dispatcher\ConfigProvider40Event dispatcher integration
Hypervel\Encryption\ConfigProvider41Data encryption services
Hypervel\Event\ConfigProvider42Event system and listeners
Hypervel\Foundation\ConfigProvider43Application foundation layer
Hypervel\Hashing\ConfigProvider44Password hashing (bcrypt, argon2)
Hypervel\Http\ConfigProvider45HTTP kernel and middleware
Hypervel\JWT\ConfigProvider46JWT authentication tokens
Hypervel\Log\ConfigProvider47Monolog logging integration
Hypervel\Mail\ConfigProvider48Email sending services
Hypervel\Notifications\ConfigProvider49Multi-channel notifications
Hypervel\ObjectPool\ConfigProvider50Object pooling for performance
Hypervel\Queue\ConfigProvider51Job queue workers and connections
Hypervel\Redis\ConfigProvider52Redis cache and session drivers
Hypervel\Router\ConfigProvider53HTTP routing system
Hypervel\Session\ConfigProvider54Session storage and management
Hypervel\Translation\ConfigProvider55Internationalization (i18n)
Hypervel\Validation\ConfigProvider56Request validation rules

Sources: src/ConfigProviderRegister.php11-57

Provider Registration Flow


Sources: src/ConfigProviderRegister.php11-66

Dynamic Provider Detection

The get() method implements conditional provider loading, specifically checking for the optional Hyperf\Devtool\ConfigProvider:


This approach allows the testbench to automatically detect and include development tools when available, without creating hard dependencies. The devtool provider adds debugging, profiling, and inspection capabilities.

Sources: src/ConfigProviderRegister.php59-66

Provider Management API

The class provides four static methods for managing the provider registry:

Method Reference Table

MethodParametersReturn TypeMutates RegistryPurpose
get()NonearrayNoRetrieve all registered providers with optional devtool
filter()callable $callbackarrayYesFilter providers using callback and update registry
add()array|string $providersvoidYesAppend new providers to registry
except()array|string $providersvoidYesRemove specified providers from registry

Sources: src/ConfigProviderRegister.php59-87

get() Method Implementation


Returns the provider array, conditionally including the devtool provider if available.

Sources: src/ConfigProviderRegister.php59-66

filter() Method Implementation


Applies array_filter() with a custom callback to the provider list. The filtered result is assigned back to static::$configProviders, making this a mutating operation.

Example Usage:


Sources: src/ConfigProviderRegister.php68-71

add() Method Implementation


Appends providers to the registry. Uses Arr::wrap() from Hyperf\Collection\Arr to normalize string or array input into an array.

Example Usage:


Sources: src/ConfigProviderRegister.php73-79

except() Method Implementation


Removes providers from the registry using array_diff(). Also uses Arr::wrap() for input normalization.

Example Usage:


Sources: src/ConfigProviderRegister.php81-87

Registry Manipulation Flow


Sources: src/ConfigProviderRegister.php68-87

Integration with Bootstrap Process

The ConfigProviderRegister plays a crucial role in the testbench initialization sequence by providing the complete list of service providers that need to be registered during application bootstrap:


This centralized approach ensures that all necessary framework components are consistently available across different test scenarios while maintaining the flexibility to customize the provider set for specific testing requirements.

Sources: src/ConfigProviderRegister.php59-66