src/Valkyrja/Support/Providers/ProvidersAwareTrait.php
public function register(string $provider, bool $force = false): void
    {
        // No need to re-register providers
        if ($this->isRegistered($provider)) {
            return;
        }

        /** @var \Valkyrja\Support\Providers\Provides $provider */

        // If the service provider is deferred
        // and its defined what services it provides
        if (! $force && $provider::deferred() && $provider::provides()) {
            // Add the services to the service providers list
            foreach ($provider::provides() as $provided) {
                self::$provided[$provided] = $provider;
            }

            return;
        }

        // Publish the service provider
        $provider::publish($this->getApplication());

        self::$registered[$provider] = true;
    }
public function register(string $provider, bool $force = false): void
    {
        // No need to re-register providers
        if ($this->isRegistered($provider)) {
            return;
        }

        /** @var \Valkyrja\Support\Providers\Provides $provider */

        // If the service provider is deferred
        // and its defined what services it provides
        if (! $force && $provider::deferred() && $provider::provides()) {
            // Add the services to the service providers list
            foreach ($provider::provides() as $provided) {
                self::$provided[$provided] = $provider;
            }

            return;
        }

        // Publish the service provider
        $provider::publish($this->getApplication());

        self::$registered[$provider] = true;
    }
Register a provider.

@param string $provider The provider
@param bool   $force    [optional] Whether to force regardless of
deferred status

@return void