Skip to content

Version 4.3.0.0

Compare
Choose a tag to compare
@skipperbent skipperbent released this 28 Mar 23:21
· 110 commits to v4-release since this release
c4cf878

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
    The input helper function and associated method InputHandler::value has been fixed to return the raw value as originally intended. As a result IInputItem is no longer returned when calling input('name'). All references to input('my-input')->getValue() should therefore be changed to input('my-input'). The IInputItem object can still be accessed by using input()->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 on IRoute 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 the InputHandler->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 for Request::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 to null.
  • 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 of routes.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 in BootManager.
  • 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 the x-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 the Request->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 the Request-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 in Router.php.
  • Changed ob_get_contents to ob_get_clean.
  • Added type hints to methods parameters/return type.
  • Moved request-types constants from abstract Route class to global Request-class and changed references.
  • Changed code to use new global request-type constants.
  • Optimized InputHandler class so it only parses inputs once when calling all-method.
  • Forced csrf-token post-value are now available for all Request::$requestTypePost request-methods.
  • Change variable name $values to $settings in Route::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.