@@ -173,7 +173,18 @@ public function put( string $route, $function, ?string $filter = null ) : RouteM
173173 */
174174protected function isRouteWithParams (RouteMap $ route ) :bool
175175{
176- return strpos ($ route ->Path ,': ' ) ==true ;
176+ return strpos ($ route ->Path ,': ' ) !==false ||strpos ($ route ->Path ,'* ' ) !==false ;
177+ }
178+
179+ /**
180+ * Check if route contains a wildcard parameter
181+ *
182+ * @param RouteMap $route
183+ * @return bool
184+ */
185+ protected function hasWildcard (RouteMap $ route ) :bool
186+ {
187+ return strpos ($ route ->Path ,'* ' ) !==false ;
177188}
178189
179190/**
@@ -207,7 +218,15 @@ protected function processRoute( RouteMap $route, $uri ) : ?array
207218
208219$ routeSegments =count (explode ('/ ' ,$ route ->Path ) );
209220
210- if ($ segments ==$ routeSegments )
221+ // Wildcard routes need >= segments, normal routes need exact match
222+ if ($ this ->hasWildcard ($ route ) )
223+ {
224+ if ($ segments >=$ routeSegments )
225+ {
226+ return $ this ->processRouteWithParameters ($ route ,$ uri );
227+ }
228+ }
229+ else if ($ segments ==$ routeSegments )
211230{
212231return $ this ->processRouteWithParameters ($ route ,$ uri );
213232}
@@ -257,22 +276,30 @@ protected function extractRouteParams( string $uri, array $details ) : array
257276$ params = [];
258277$ iOffset =0 ;
259278
260- foreach ($ uriParts as $ part )
279+ foreach ($ details as $ index => $ detail )
261280{
262- if ($ iOffset >=count ($ details ) )
281+ if ($ iOffset >=count ($ uriParts ) )
263282{
264283return [];
265284}
266285
267- $ action =$ details [$ iOffset ]['action ' ];
286+ $ action =$ detail ['action ' ];
287+ $ isWildcard =$ detail ['wildcard ' ] ??false ;
268288
269- if ($ action &&$ action !=$ part )
289+ if ($ isWildcard )
290+ {
291+ // Wildcard parameter - capture all remaining URI segments
292+ $ remainingParts =array_slice ($ uriParts ,$ iOffset );
293+ $ params [$ detail ['param ' ] ] =implode ('/ ' ,$ remainingParts );
294+ break ;// Wildcard consumes rest of URI
295+ }
296+ else if ($ action &&$ action !=$ uriParts [$ iOffset ] )
270297{
271298return [];
272299}
273- else
300+ else if ( $ detail [ ' param ' ] )
274301{
275- $ params [$ details [ $ iOffset ][ 'param ' ] ] =$ part ;
302+ $ params [$ detail [ 'param ' ] ] =$ uriParts [ $ iOffset ] ;
276303}
277304
278305$ iOffset ++;