Commit Graph

461 Commits

Author SHA1 Message Date
Simon Sessingø d6d83ac5bd Parameters are now correctly passed on to sub-routes 2021-03-29 17:05:45 +02:00
Simon Sessingø b05bbccc28 [FEATURE] Added support for parameters in group prefix. 2021-03-29 16:56:37 +02:00
Simon Sessingø d6bc713e5b [CLEANUP] Added qualifier import. 2021-03-29 15:40:50 +02:00
Simon Sessingø 8eba5ab3d5 [FEATURE] php8 compatibility.
- Fixed possible error causing parameters not to be set properly when using partialGroup.
- Removed unused import reference.
- Added unit-tests.
2021-03-29 15:11:58 +02:00
Simon Sessingø c916a1dd2e [CLEANUP] Cleaned up code
- Change variable $values to $settings in Route::setSettings method.
- Added return types to methods.
- Added type to method variables.
- Change ClassNotFoundException so required parameters are first.
2021-03-29 00:00:01 +02:00
Simon Sessingø 9ed2d2b8d1 Updated Request::isPostBack to return true if request-method could contain data in body. 2021-03-28 23:32:33 +02:00
Simon Sessingø caf30cb056 Merge pull request #523 from skipperbent/v4-isPostBack
[FEATURE] Added Request::isPostBack helper method
2021-03-28 04:25:54 +02:00
Simon Sessingø 6ccd06911e Fixed possible bug causing InputHandler not to get the correct request-method + simplified Request class. 2021-03-28 04:24:33 +02:00
Simon Sessingø e5eb966780 Added Request::isPostBack helper method 2021-03-28 04:05:09 +02:00
Simon Sessingø 073479f9dd [BUGFIX] Fixed group not matching domain with no parameters (issue: #468).
- Added unit-tests
2021-03-26 01:32:01 +01:00
Simon Sessingø 39ee1bb7cd Added missing phpDocs for parameters. 2021-03-25 14:31:04 +01:00
Simon Sessingø cf1c59aee0 Changed parameter name and added parameter phpDocs description. 2021-03-25 14:24:50 +01:00
Simon Sessingø cf6750aaf3 [FEATURE] Optimised Request::getIp method
- Added unit-tests for Request::getIp
- Optimised existing RequestTest unit-tests.
2021-03-25 14:18:56 +01:00
DeveloperMarius 4cb2fa521f v4-development sync 2021-03-25 13:41:04 +01:00
Simon Sessingø 8835aca02e [FEATURE] Added Request::getContentType for content-type header-parsing
- Added unit-tests for Request::getContentType parsing.
2021-03-25 13:09:23 +01:00
Simon Sessingø 86bb88a41f [FEATURE] Added better support for nested file/arrays in InputHandler.
- Added unit tests for file arrays
- Removed legacy .yml configs
2021-03-25 05:58:49 +01:00
Simon Sessingø 2b9403db28 Features & bugfixes
- Feature: added new getFirstHeader to Request object that will return 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.
- Fixed calling getUrl with array as parameters option throws error.
- Fixed `SimpleRouter::getUrl` having wrong nullable return type.
2021-03-25 03:41:11 +01:00
Simon Sessingø 0ec7c0d960 Optimisations
- Added phpunit cache to .gitignore
- Updated README with latest helper.php example.
- Minor phpDocs changes.
2021-03-24 23:18:17 +01:00
Simon Sessingø 635b127357 Fixed correct return type for InputFile. 2021-03-23 15:06:21 +01:00
Simon Sessingø b9af44299e Merge pull request #514 from skipperbent/v4-inputitem-value
[FEATURE] Add support for mixed value types in InputItem as requested by #438
2021-03-23 15:02:18 +01:00
Simon Sessingø a33f2f7e7a Merge branch 'v4-development' into v4-disable-multi-routing 2021-03-23 15:00:01 +01:00
Simon Sessingø 2689486e64 Merge pull request #509 from skipperbent/v4-request-same-routes
[BUGFIX] Issue #439: Fixed multiple request-type on same routes.
2021-03-23 14:57:17 +01:00
Simon Sessingø dfc12d07b0 Merge pull request #508 from skipperbent/v4-bootmanager-fix
[BUGFIX] BootManager findRoute not working.
2021-03-23 14:56:16 +01:00
Simon Sessingø 680e0256c3 Merge branch 'v4-development' into feature-default-namespace 2021-03-23 14:52:39 +01:00
Simon Sessingø 90b0747dbd [BUGFIX] Add support for mixed value types in InputItem as requested by #438 2021-03-23 01:36:23 +01:00
Simon Sessingø 67211e5332 Updated readme + gitignore 2021-03-23 01:24:17 +01:00
Simon Sessingø a44a93d705 [!!!][FEATURE] Removed php-di as suggested by #477
NOTE: Custom class-loader should be used to create custom integrations with frameworks like php-di. See documentation for more information.

- Removed all references to php-cli from composer + code.
- Added ClassLoader php-unit tests.
2021-03-23 00:46:17 +01:00
DeveloperMarius 5508c73e85 getIp() update to new header method 2021-03-22 22:32:44 +01:00
DeveloperMarius d5dc81e26e v4-development sync & getIp() update to new header method 2021-03-22 22:25:37 +01:00
Simon Sessingø 1d2e5f47d9 [FEATURE] Option to disable multi-route rendering
- Added option to disable multi-route rendering by calling `Router::setRenderMultipleRoutes($bool)`.
- Added alias for easier access `SimpleRouter::enableMultiRouteRendering($bool)`.
- Added php-unit tests for multi-routing enabled and disabled.
2021-03-22 19:34:55 +01:00
Simon Sessingø 2fb59854be [BUGFIX] Issue #439: Fixed multiple request-type on same routes. 2021-03-22 18:33:16 +01:00
Simon Sessingø 801f1e68cc [BUGFIX] BootManager findRoute not working.
- Fixed findRoute not working in BootManager as reported by issue: #448
- Added more comprehensive php-unit tests for bootmanagers including findUrl.
2021-03-22 18:05:27 +01:00
Simon Sessingø fa83d2f74b Default-namespace changes.
- Added new ClassNotFoundHttpException thrown when class is not found.
- ClassNotFoundHttpException is now thrown when class/method is not found (backwards compatible).
- Added unit-tests for default-namespace tests (rewrite + append cases).
2021-03-22 17:03:22 +01:00
Simon Sessingø fd585e8b9d [FEATURE] Changed behavior for default-namespace after issue #446
- Router::setDefaultNamespace() no longer has to be set in the beginning of routes.php.
- Default namespace are now set once the router is started (Router::start()).
- [WIP] Added unit-tests for custom-namespaces.
2021-03-22 16:41:20 +01:00
Simon Sessingø 11fffd9a7b [FEATURE] Added option to get/set the filterEmptyParams option on IRoute classes (as requested by: #453). 2021-03-22 15:06:20 +01:00
Simon Sessingø 8a0f30c05e Custom regex fix
- Fixed issue with custom-regex maching both host-name and url (issue: #503).
- Changed TestRouter so host-name is always set.
2021-03-22 14:09:27 +01:00
Marius Karstedt 1e0417b249 also check remote-addr (can be edited https://stackoverflow.com/questions/5092563/how-to-fake-serverremote-addr-variable) 2021-03-22 11:18:16 +01:00
Marius Karstedt 24f7e3ab13 Validate IP header 2021-03-22 11:15:47 +01:00
Simon Sessingø d2b3ea4f54 Added better header parsing to Request-class.
- Added `tryParse` argument to the `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.
2021-03-22 11:14:22 +01:00
Marius Karstedt 90a0ca2ee8 Add cf ip header to none save call 2021-03-22 11:06:33 +01:00
Marius Karstedt 9897f66a25 Add $safe 2021-03-22 11:04:33 +01:00
Marius Karstedt e77b723db3 Add http-client-ip header 2021-03-22 10:57:58 +01:00
Simon Sessingø 0aeefa1cba Removed ob_end_clean when using ob_get_clean. 2021-03-21 15:22:35 +01:00
Simon Sessingø 8254c5b100 Development
- Removed unused class references.
- Removed escape from `-` in reg-ex as it's only required when next to character-class.
- Added `$_FILE` support for `all` method.
- Bugfixes.
2021-03-21 15:19:27 +01:00
Simon Sessingø e8a1eac167 Development
- 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 availible in all requestTypePost methods.
2021-03-21 14:52:34 +01:00
Simon Sessingø 2ff278baef Merge branch 'get-csrf-token' of https://github.com/DeveloperMarius/simple-php-router into DeveloperMarius-get-csrf-token 2021-03-21 14:16:20 +01:00
Marius Karstedt 31b4b4673e add csrf token check for patch 2021-03-21 12:20:57 +01:00
Marius Karstedt 05e5461acb get csrf token in request; Test for prefix 'http-' in csrf token header 2021-03-21 11:40:37 +01:00
Simon Sessingø 4674dbef1a Merge branch 'v4-development' into fix-partial-group 2021-03-21 07:57:01 +01:00
Simon Sessingø d70b153189 [BUGFIX] Fixed issue with child groups not loading when using partialGroups (issue: #456) 2021-03-21 07:39:17 +01:00