Skip to content

Upgrade Service Manager to v4#88

Open
simon-mundy wants to merge 5 commits intolaminas:4.0.xfrom
simon-mundy:service-manager-v4
Open

Upgrade Service Manager to v4#88
simon-mundy wants to merge 5 commits intolaminas:4.0.xfrom
simon-mundy:service-manager-v4

Conversation

@simon-mundy
Copy link

@simon-mundy simon-mundy commented Feb 4, 2026

Q A
Documentation no
Bugfix yes
BC Break yes
New Feature no
RFC no
QA yes

Description

This PR addresses issues #75 and #76 and seeks to modernise the codebase for a 4.0.x release.

The existing Filter and View components have been used as guidance, and I have been
aggressive in seeking better psalm compliance, refactoring of code and tests and
removing outdated/deprecated code.

Breaking Changes

  • Requires laminas-servicemanager ^4.0
  • Removed Wildcard route
  • Route classes now use strict typing for all parameters
  • Attempted to use Interfaces to type as much as possible instead of static

RoutePluginManager

  • Refactored with CONFIGURATION constant for default routes
  • Routes must be explicitly registered or use invokables config

Route Classes

  • All route classes use final modifier where applicable
  • Constructor property promotion throughout
  • Added RoutePriorityTrait for consistent priority handling
  • Added RouteConfigTrait for standardized option processing and iterator conversion
  • setPriority()/getPriority() added to RouteInterface

Code Quality

  • Factories marked as final readonly
  • Exception classes marked as final
  • Superceded ArrayUtils::iteratorToArray() with trait-based implementation

NOTES

  • Unsure as to how to introduce i18n testing - TranslatorInterface used sparingly for now

@simon-mundy
Copy link
Author

simon-mundy commented Feb 6, 2026

Well... I had some time to experiment today so I took and idea and ran with it. Even if we don't end up using this, it was worth the time to better understand the component.

So I ended up separating the PriorityList $routes in the Stacks, renamed them to RouteContainer for clarity, then created a base Interface, and extended Interfaces for SimpleRouteStack and for HttpRouteStack so that subsequently each Route type ends up with a properly-suited RouteInterface (both the RouteMatch and RouteInterfaces both had very http-specific differences).

Now this is fully refactored to use PSR-7 requests, and I could remove dependencies - except Laminas\Uri which we need to help assemble routes.

I understand this is now a bigger concern in terms of a PR, but as a I said I'm happy to pull back a bit and re-release in sections if that helps us understand how best to approach this.

@gsteel
Copy link
Member

gsteel commented Feb 13, 2026

@simon-mundy Sorry I was just about to review, but I merged #95 so a rebase is needed here.

I'm also likely going to merge #92 which will get merged up into 4.0.x once released, so maybe hold off until that's in so rebase is only needed once.

@gsteel
Copy link
Member

gsteel commented Feb 13, 2026

#92 is now released and merged-up

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy
Copy link
Author

Thanks @gsteel I've rolled in that change to my PR and it's clearer to see where it sits.

Signed-off-by: Simon Mundy <46739456+simon-mundy@users.noreply.github.com>
@froschdesign froschdesign added this to the 4.0.0 milestone Feb 15, 2026
@froschdesign froschdesign linked an issue Feb 15, 2026 that may be closed by this pull request
@simon-mundy
Copy link
Author

Hi @gsteel @froschdesign did you want to discuss any of the code improvements?

simon-mundy and others added 3 commits February 22, 2026 10:04
- Updated tests to reflect new factory change
- Removed unnecessary ServiceListener check
- Changed string literal to class check in RouterConfigTrait.php

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
Signed-off-by: Simon Mundy <46739456+simon-mundy@users.noreply.github.com>
- Minor fixes required after merge in github
- Cleanup psalm baseline

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@fezfez
Copy link
Contributor

fezfez commented Feb 22, 2026

@simon-mundy imo you could split your pr in multiple one, the review would be easier and your work could be merged faster

  • add strict type
  • code quality
  • add sm v4
  • fix deprecated property $prority

@simon-mundy
Copy link
Author

@fezfez I haven't split these before - do I create individual PRs for this? For each item you've listed? It may or may not be easy to separate everything but I'll see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade Service Manager to v4

5 participants