Releases: Digital-Media/fhooe-router
Releases · Digital-Media/fhooe-router
v2.0.0
2.0.0 - 2025-03-26
Added
- Added support for placeholders in routes.
- Added support for optional route parts.
RouteAlreadyExistsException: thrown when adding a route that already exists.- More and better tests.
Changed
- Switched to PHP 8.4 as a minimum requirement.
getUri()now returns "/" if the request URI cannot be determined.Router::getRoute()now returns "GET /" if the request URI cannot be determined.- A
LoggerInterfaceobject is now injected in the constructor. - A route that is already registered, can't be added again. This will throw a
RouteAlreadyExistsException. - More and more verbose logging messages.
- The log message for a matching route is now issued before the callback is executed.
- Updated all dependencies.
Removed
- Removed
LoggerAwareTraitfromRouter.
Security
- Updated logging calls with proper PSR-3 placeholder replacement.
v1.0.0
1.0.0 - 2024-02-05
Added
- Added PEST for testing.
- The
Routerobject ($this) is now passed to the callback of a route for access to the router's methods.
Changed
- Switched to PHP 8.3 as a minimum requirement.
- Switched return type of
redirect()andredirectTotonever. addRoute()now accepts an enumHttpMethodinstead of a string. This removes the necessity to check the validity of the input. If it's not a valid enum value, the interpreter throws aTypeError. Plus, it introduces enums to students.- Checked log calls for null safety.
basePathis now a property and not static anymore.- Class constants are now typed.
- Updated all dependencies.
Removed
composer.lockis now excluded from version control for more flexibility.
v0.3.0
0.3.0 - 2022-01-24
Added
- Added two redirect methods to the router.
redirectTo()will accept a route pattern, whereasredirect()will take a URL as an argument.
Changed
urlFor()now only accepts a route pattern (e.g. "/form"). No method has to be specified anymore since the method is not necessary in determining the full URL for a pattern.- Bumped phpstan/phpstan to 1.4.
v0.2.0
0.2.0 - 2021-12-22
Added
- The
Routerclass is now PSR-3 compatible and builds upon thePsr\Loginterfaces. The class uses theLoggerAwareTraitto instantiate a logger instance withNullLogger. See also 2: Add logging capabilities. - Logging messages that inform users about added routes, route matches, a set 404 callback and an executed 404 callback.
- Added a static
getBasePath()method to retrieve the base path. This can be used in view templates to prepend the base path to URLs.
v0.1.0
0.1.0 - 2021-12-16
Added
- Complete
Routerclass with dynamic and static functionality. - Allowed setting routes for GET and POST protocols with patterns and invocable callbacks.
- Defined a method for adding a 404 callback handler when no route matches.
- Added a method for specifying a base path if the project is not in the server's root directory.
- Added
HandlerNotSetExceptionclass that is thrown when no 404 callback is defined. - Added an additional static routing method as an alternative and simpler way to approach the routing concept.
- Set up
composer.jsonfor the use with Composer and Packagist. - Added phpstan for code analysis.
- Added extensive
README.md. - Added notes on Contributing.
- Added this changelog.