Releases: skipperbent/simple-php-router
Version 4.3.4.2
- Issue #551: Fixed issue with SimpleRouter::error not firing within group.
- Fixed variable incorrect variable reference in
InputItem
class. - Added new
Router::addExceptionHandler
method. - Added parameter types in
Url
class. - Fixed phpdoc parameter-type for
Request::getHeader
.
Version 4.3.4.1
- Issue #551: fixed issue causing
SimpleRouter::error
helper not to work when used within a group. - Tests: added unit test for nested group calls to
SimpleRouter::error
.
Version 4.3.4.0
InputItem
can now be used like array (for example:input()->post('items')[0]
) if value is array.- Changed default-value parameter for
get
,post
andfile
methods to allow for mixed object as return-type(input()->post('form', new InputItem('post'))
. - Fixed
InputItem->__toString()
to correctly parsenull
default-value. - Tests: changed parameter in
call_user_func_array
for PHP 8 compatibility in unit-tests.
Version 4.3.3.0
- [FEATURE] Namespace overwrite now works globally.
Service
will append to any existing namespace whereas\Service
will overwrite it. - [FEATURE] Exception handlers are now rendered in reverse order from newest to oldest. This allows for exceptions to be handled from parent exceptions which were otherwise ignored.
- Fixed incorrect return type for
InputFile::getError
to correct nullable int. - Added return type to
all
,match
,controller
andresource
inSimpleRouter
class. - Fixed incorrect return-type usage of
parse_str
function inUrl::setQueryString
method. - Fixed incorrect expected value in
array_flip
function inUrl::removeParams
method. - Tests: added namespace overwrite group unit-tests.
Version 4.3.2.3
Changelog
- Fixed deprecated notice when using class type hinting (issue: #538).
- Minor optimisations.
Version 4.3.2.2
Changelog
- Removed
?string
return type fromIResourceController
as the return type can be mixed.
Version 4.3.2.1
Changelog
- Feature: Added optional
includeParams
parameter toUrl::getRelativeUrl
andUrl::getAbsoluteUrl
methods. - Issue: Fixed issue with
BaseCsrfVerifier
matching urls against urls with parameters.
Version 4.3.2.0
Changelog
- Feature: Added IP-access restrictions with credits to @DeveloperMarius.
- Feature: Added new
include
property toBaseCsrfVerifier
for routes that should be allowed when used in conjunction with theexclude
property and url-ranges (like/admin/*
). - Feature: Added
https
scheme support toRequest::setUri
(used when calling$request->getUrl()->getAbsoluteUrl()
. - Feature: Added
isSubRoute
event parameter forEVENT_ADD_ROUTE
. - Feature: Added method
IGroupRoute::prependPrefix
. - Feature: Added custom base path example to the documentation.
- Tests: Added
BaseCsrfVerifier
unit-tests. - Tests: Added custom base path event unit-tests.
- Updated documentation with changes & updates.
Version 4.3.1.0
Release notes
- Router now uses
IClassLoader
to load class methods. If you use a custom class-loader, make sure that you implement the newloadClassMethod
from theIClassLoader
interface.
Changelog
- Feature: Added class + method loading to
IClassLoader
. - Feature: Added support for parameters in group prefix.
- Issue: Fixed PHP 8 compatibility issues with
call_user_func_array
inClassLoader
. - Issue: Fixed parameters from parent-routes not correctly passed to child routes.
- Issue: Fixed possible error causing parameters not to be set properly when using some groups.
- Issue: Fixed
InputHandler::find
andInputHandler::value
failing when usingarray
in methods parameter. - Issue: Fixed csrf-token postback not being recognized.
- Cleanup: Removed unused import reference.
- Tests: Added more partial-group tests.
- Tests: Added deep route-parameters pass unit-test
- Tests: Added
InputHandler::find
tests. - Updated documentation to reflect changes.
Version 4.3.0.0
Breaking changes
THIS UPDATE CONTAINS BREAKING CHANGES!
PLEASE READ THE NOTES CAREFULLY BEFORE UPDATING ANY LIVE ENVIRONMENT.
-
php-di no longer integrated by default
php-di integration is still possible, however a custom class-loader is now used to create integrations with frameworks of choice. See the "Class Loader" section in the documentation for more information and examples on how to migrate your existing php-di integration. -
Return type for
input()
helper
Theinput
helper function and associated methodInputHandler::value
has been fixed to return the raw value as originally intended. As a resultIInputItem
is no longer returned when callinginput('name')
. All references toinput('my-input')->getValue()
should therefore be changed toinput('my-input')
. TheIInputItem
object can still be accessed by usinginput()->find('my-input')
instead.
Changelog
- Feature: Added better ip-parsing when calling
Request::getIp()
and added new optional$safeMode
parameter. - Feature: Added
Request::getContentType
for content-type header-parsing. - Feature: Added better support for nested file/arrays in
InputHandler
. - Feature: Added support for GitHub actions thanks to @DeveloperMarius
- Feature #438: Added support for mixed value types in
InputItem
. - Feature #477: Removed php-di
- Feature #452: Added option to disable multi-route rendering by calling
Router::setRenderMultipleRoutes($bool)
). - Feature: Added alias for easier access
SimpleRouter::enableMultiRouteRendering($bool)
. - Feature #491: Added support for class hinting on routes.
- Feature #453: Added option to get/set the
filterEmptyParams
option onIRoute
classes. - Feature #446 #507: Default-namespace optimisations.
- Feature: Added new
Request::getFirstHeader
method that returns the first header found from array list- used to simplify the code. - Feature: Added new
InputHandler::getValueFromArray
method that loops through input-items to ensure that value is always returned when calling theInputHandler->value()
method. - Feature: Added new
ClassNotFoundHttpException
thrown when class is not found. - Feature: Added support for objects like array etc as default-value. Value is now less strict and accept mixed objects.
- Feature: Added
$_FILE
support forRequest::all
method. - Feature: Parameters are by default now using regex
[\w\-]+
(supports dashes) to avoid any confusion. - Feature #461:
input()->all()
will now always return keys defined. If the key doesn't exists the value will be set tonull
. - Feature: Added
Request::isPostBack
helper method that returns true if request-method is of type that could contain data in body. - Feature: Optimized namespace handling. When namespaces starts with
\
they will always overwrite the default-namespace. - Issue #446:
Router::setDefaultNamespace()
no longer has to be set in the beginning ofroutes.php
. - Issue #468: Fixed group not matching domain when using domain with no parameters.
- Issue #439: Fixed multiple request-type on same routes.
- Issue #456: Fixed issue with child groups not loading when using
partialGroups
. - Issue #437: Fixed CSRF-token returning null on first refresh after cookies are removed.
- Issue #503: Fixed issue with custom-regex maching both host-name and url.
- Issue #448: Fixed
findRoute
not working inBootManager
. - Issue #450: Fixed issue with cookie-expiration timestamp for 32-bit PHP versions.
- Issue #449: Fix 'must be an instance of
Closure
,array
given' error when$closure
is a object method. - Issue: Fixed calling
SimpleRouter::getUrl
with array as parameters option would throw an error. - Issue: Fixed
SimpleRouter::getUrl
having wrong nullable return type. - Issue: Fixed typo in
getIp
method when server is using thex-forwarded-for
header. - Issue: Fixed possible bug causing
InputHandler
not to get the correct request-method. - Simplified constructor in
Request
class. ClassNotFoundHttpException
is now thrown when class/method is not found (backwards compatible).- Removed all references to
php-di
from composer + code. - Added
tryParse
argument to theRequest->getHeader
method. When enabled the method will try to parse headers from both server and client-side (enabled by default). - Simplified references that checks for both variants of header (http/non http).
- Simplified
getIp
method of theRequest
-class. - Optimized
InputHandler
to better support for nested values. - Removed unused exception from PHP-docs.
- Fixed types not same as declared.
- Removed unnecessary type casting.
- Declared functions as static (better scoping + performance).
- Moved
\is_callable($callback) === false
as the execution costs less than previous inRouter.php
. - Changed
ob_get_contents
toob_get_clean
. - Added type hints to methods parameters/return type.
- Moved request-types constants from abstract
Route
class to globalRequest
-class and changed references. - Changed code to use new global request-type constants.
- Optimized
InputHandler
class so it only parses inputs once when callingall
-method. - Forced
csrf-token
post-value are now available for allRequest::$requestTypePost
request-methods. - Change variable name
$values
to$settings
inRoute::setSettings
and related methods. - Updated link to demo-project in README.
- Updated README.
- Removed unused class references.
- Removed escape from
-
in reg-ex as it's only required when next to character-class. - Removed legacy .yml configuration.
- Removed
.idea
folder. - Other minor cleanup, bugfixes & optimisations.
- Tests: Added unit-tests for default-namespace tests (rewrite + append cases).
- Tests: Added more comprehensive php-unit tests for bootmanagers including
findUrl
. - Tests: Changed
TestRouter
so host-name is always set when using php-unit. - Tests: Added php-unit-test for
input()->all()
method. - Tests: Fixed issues with reg-ex and php-unit tests.
- Tests: Added
ClassLoader
php-unit tests. - Tests: Added php-unit tests for enabled/disabled multi-routing.
- Tests: Added file tests for
InputHandler
. - Tests: Added unit-tests for
Request::getContentType
parsing. - Tests: Added unit tests for file arrays.
- Tests: Added unit-tests for
Request::getIp
. - Tests: Added unit-tests for group domain when using domain with no parameter.