Skip to content

[NFR]: Remove DI and MVC types from HistoryEndpoint #41

Closed

Description

@niden

Summary

HistoryEndpoint requires a Phalcon\Di\DiInterface, so it cannot run in an ADR app. Make the URL logic neutral, and move the MVC dispatcher logic to an MVC listener. MVC behavior does not change.

Current coupling

  • The constructor requires DiInterface (src/DebugBar/History/HistoryEndpoint.php:39).
  • __invoke() uses Phalcon\Mvc\DispatcherInterface to select the controller (src/DebugBar/History/HistoryEndpoint.php:43).
  • cookiePath() reads Phalcon\Mvc\Url\UrlInterface from DI (src/DebugBar/History/HistoryEndpoint.php:57).
  • matches() reads the request from DI (src/DebugBar/History/HistoryEndpoint.php:85).

Proposed direction

  • HistoryEndpoint keeps matches(), cookiePath() and url(). It gets the request and the base URI through small resolvers.
  • Keep the read at call time, as it is now. The current code reads request and url when it needs them, not at boot.
  • Move the dispatcher selection in __invoke() to a new MVC listener. Provider::registerHistory() attaches the new listener to application:beforeHandleRequest.
  • Provider gives resolvers that read from DI, so the MVC result does not change.
  • Add an optional base URI config key with default / for hosts with no DI. AdrProvider registers no url service.

Notes

Acceptance

  • HistoryEndpoint has no Phalcon\Di or Phalcon\Mvc imports.
  • HistoryEndpoint accepts a request and a base URI with no container.
  • The existing history tests pass with the same expected results. Tests of the dispatcher selection move to the new listener with the same assertions.
  • 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. changed the title [-][NFR]: Remove DI and MVC types from HistoryEndpoint`[/-] [+][NFR]: Remove DI and MVC types from HistoryEndpoint[/+] on Nov 3, 2026
  5. niden commented on Nov 4, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #57

  6. moved this from Active Sprint to Implemented in Phalcon v5on Nov 4, 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