Skip to content

feat/static router - #15

Open
abdul-kaioum wants to merge 11 commits into
mainfrom
feat/static-router
Open

feat/static router#15
abdul-kaioum wants to merge 11 commits into
mainfrom
feat/static-router

Conversation

@abdul-kaioum

Copy link
Copy Markdown
Member
  • feat: static router to render wordpress page/post url for custom usecases
  • fix: route path not matching for root
  • fix: returning '' on the_content filter
  • fix: accessing property before initialized
  • chore: refactor. added precaution
  • chore: fix type
  • fix: namespace
  • Fix: static route regex
  • fix: chained middleware() dropped args, use array_merge

Internal restructure with the public API frozen (consumed by downstream plugins). Response moves to instance state behind a static facade; Router gains a type-keyed registry; route blocking uses an internal exception instead of a polled flag; response emission becomes per-transport strategies; one RoutePattern compiler serves REST/AJAX/static matching; IpTool splits into Http\\Detection\\{ClientIpResolver,UserAgent}.

New collaborators: RoutePattern, MiddlewareRegistry, ResponseEnvelope, RewriteRuleSet, RouteBlockedException, MiddlewareConfigurationException, Emitter\\{ResponseEmitter,Api,Ajax,Static}ResponseEmitter.

Security: HttpClient safe-by-default (wp_safe_remote_request, allowUnsafeUrls opt-in); trusted-proxy X-Forwarded-For resolution; fail-closed middleware; response header-injection validation.

Adds a PHPUnit contract suite + PHPDBG coverage gate (100% on selected HTTP methods). PHP 7.4 compatible.

Assisted-By: AI
Bump platform floor to PHP 8.0 (composer require + phpcs compat testVersion 8.0-). Add param/return/property type declarations and 8.0 idioms (match, str_contains, constructor promotion, null-coalescing) across src via Rector run to a fixpoint.

BC-conservative at extension points: public accessors on the extendable Request (and the IpTool trait) stay untyped so consumer subclass overrides keep compiling; Arr's public helper params stay untyped to preserve arg coercion. rector.php skips these files and a Request-subclass contract test pins the untyped-override guarantee. No strict_types, no enums/readonly (would break coercion / string constants / need 8.1).

Fixes surfaced during typing: HttpClient::getBoundary() assigned $this to the boundary (object-to-string fatal on multipart); ShortcodeWrapper::doShortcode() and Request::input() discarded their return values; Request::files() could return null under an array contract.

Tooling: remove the lefthook hook shim; add captainhook + hook-installer with a pre-commit hook running cs-fixer (check), compat, and tests. Rewrite README into an accurate quick-start.

Assisted-By: AI
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.

1 participant