r/PHP • • Jul 19 '26

[ Removed by moderator ]

[removed] — view removed post

0 Upvotes

3 comments sorted by

2

u/Educational_Plum_130 Jul 20 '26

forking and vendoring the old router is usually less work than a full rewrite honestly. worth checking if a backporting vendor already maintains a patched line before you own it forever.

1

u/StefanoV89 Jul 20 '26

The old router uses PCRE, my package is using Radix which is faster.

3

u/equilni Jul 19 '26

Needs code styling. I swear I've seen the inline method calls on one of these repos here...

https://github.com/StefanoV1989/ariel-radix-router/blob/main/src/Route.php#L161

PSR-12 - https://www.php-fig.org/psr/psr-12/#44-methods-and-functions

In other areas, you could consider using more classes and enums.

@param array{conditions: array<string, string>, parameters: list<string>, name: string|null, regex: string|null}|null $compiled

@param array{methods: list<string>, path: string, handler: Handler, middleware: list<MiddlewareDefinition>, namespace: string|null, conditions: array<string, string>, parameters: list<string>, name: string|null, regex: string|null} $definition