Make SchematicServiceProvider a deferred service provider#5
Merged
Conversation
Implement DeferrableProvider so the provider is only loaded when Compiler or Schematic are actually resolved from the container, improving application boot performance. https://claude.ai/code/session_01MTPJtVBeW4Bb2iqGUHfcTg
There was a problem hiding this comment.
Pull request overview
Updates the package’s Laravel service provider to be deferred so it only loads when Compiler or Schematic is resolved, aiming to improve application boot performance.
Changes:
- Implements
Illuminate\Contracts\Support\DeferrableProvideronSchematicServiceProvider. - Adds a
provides()method declaringCompiler::classandSchematic::classas deferred services.
Comments suppressed due to low confidence (1)
src/SchematicServiceProvider.php:12
- Making this provider deferrable means
register()/boot()will not run untilCompilerorSchematicis first resolved. That changes package behavior: (1)mergeConfigFrom()won’t run during normal boot/config caching, soconfig('schematic.schema.draft')(used without a default in schema document generation) can becomenullunless the user publishes config; (2)vendor:publish --tag=schematic-*may not see any publishable resources becauseboot()won’t execute, which conflicts with the installation steps in the README. Consider keeping this provider eager, or splitting into an eager provider for config merging + publish registration and a separate deferrable provider for the container singletons, or alternatively ensure allconfig('schematic.*')reads have safe defaults and publish tags are registered eagerly.
class SchematicServiceProvider extends ServiceProvider implements DeferrableProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/schematic.php', 'schematic');
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement DeferrableProvider so the provider is only loaded when Compiler or Schematic are actually resolved from the container, improving application boot performance.