Skip to content

Make SchematicServiceProvider a deferred service provider#5

Merged
yannelli merged 2 commits intomainfrom
claude/add-deferred-service-provider-uljTs
Mar 19, 2026
Merged

Make SchematicServiceProvider a deferred service provider#5
yannelli merged 2 commits intomainfrom
claude/add-deferred-service-provider-uljTs

Conversation

@yannelli
Copy link
Copy Markdown
Owner

Implement DeferrableProvider so the provider is only loaded when Compiler or Schematic are actually resolved from the container, improving application boot performance.

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
Copilot AI review requested due to automatic review settings March 19, 2026 22:15
@yannelli yannelli self-assigned this Mar 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\DeferrableProvider on SchematicServiceProvider.
  • Adds a provides() method declaring Compiler::class and Schematic::class as deferred services.
Comments suppressed due to low confidence (1)

src/SchematicServiceProvider.php:12

  • Making this provider deferrable means register()/boot() will not run until Compiler or Schematic is first resolved. That changes package behavior: (1) mergeConfigFrom() won’t run during normal boot/config caching, so config('schematic.schema.draft') (used without a default in schema document generation) can become null unless the user publishes config; (2) vendor:publish --tag=schematic-* may not see any publishable resources because boot() 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 all config('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.

@yannelli yannelli merged commit 09370ad into main Mar 19, 2026
4 checks passed
@yannelli yannelli deleted the claude/add-deferred-service-provider-uljTs branch March 19, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants