Skip to content

[NFR]: Extract a neutral boot core from Provider #40

Closed

Description

@niden

Summary

Provider holds all the boot logic and requires a Phalcon\Mvc\Application. Move the logic that does not need MVC or DI to a new class. MVC behavior does not change.

Current coupling

  • The constructor requires Phalcon\Mvc\Application (src/DebugBar/Provider.php:105).
  • boot() calls getDI() and getEventsManager() (src/DebugBar/Provider.php:161, :176).
  • buildCollectors(), resolveConfig() and resolveRequest() take a DiInterface (src/DebugBar/Provider.php:221, :331, :359).

Proposed direction

  • Add a new class with no Phalcon\Mvc or Phalcon\Di imports. It takes:
    • ?Phalcon\Events\ManagerInterface
    • ?Phalcon\Http\RequestInterface
    • ?Phalcon\Config\ConfigInterface
    • the config array
    • optional history parts, so that Provider can pass them
  • Move these to the new class: config parsing, the environment and env.strict checks, collector creation, Debug::setBar() and collector subscription.
  • The new class exposes the method from [NFR]: Extract a neutral injection method from ResponseListener #39, for hosts with no events manager.
  • Provider keeps its constructor, boot(), isAllowed(), registerHistory() and the application:beforeSendResponse attachment. registerHistory() stays because it needs DI.

Notes

  • Keep the current MVC result for ConfigCollector (src/DebugBar/Provider.php:269): a DI with no config service creates the collector with a null config.
  • Update the provider_config type in DebugBarTypes if the config changes.

Acceptance

  • A test boots the new class with no Phalcon\Mvc\Application and no Phalcon\Di\DiInterface.
  • The 30 existing ProviderTest tests pass with the same expected results.
  • Tests pass with full coverage. phpcs and phpstan pass.

Depends on

Part of

#13

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. added theissue type on Nov 3, 2026
  3. moved this from Backlog to Active Sprint in Phalcon v5on Nov 3, 2026
  4. niden commented on Nov 3, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #50

  5. moved this from Active Sprint to Implemented in Phalcon v5on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

  • Status
    Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions