Commit Graph

463 Commits

Author SHA1 Message Date
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
Simon Sessingø 21d180ebc9 [FEATURE] Added support for class hinting on routes as requested by #491 2021-03-21 05:55:18 +01:00
Simon Sessingø e78040aabd Fixed existing unit-tests. 2021-03-18 21:58:40 +01:00
Simon Sessingø 252cc4a75d Optimized InputHandler to better support nested values. 2021-03-18 21:58:12 +01:00
Simon Sessingø 24ef438334 Merge pull request #495 from SimonSchobel/patch-1
Fixed bug in getIp
2021-03-18 14:03:39 +01:00
Simon Schøbel 6fc0241bab Fixed bug in getIp
Fixed typo
2021-03-18 08:12:48 +01:00
Simon Sessingø 19b1a14dec Parameters are by default now using regex [\w\-]+ (supports dashes) to avoid confusion. 2021-03-18 03:24:47 +01:00
Simon Sessingø fb726c3613 Issue #437: Fixed CSRF-token returning null on first refresh after cookies are removed. 2021-03-18 02:50:06 +01:00
Simon Sessingø ff8ef9d412 Merge branch 'v4-development' of github.com:skipperbent/simple-php-router into v4-development 2021-03-17 20:20:56 +01:00
Simon Sessingø ca88e86c3d Development
- Removed unused exception from PHP-docs.
- Fixed types not same as declared.
- Fixed issues with reg-ex and php-unit tests.
- 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.
2021-03-17 20:20:28 +01:00
Simon Sessingø 5a24dfd4a1 Merge pull request #461 from b3none/master
Alter behaviour of input()->all when a filter is passed.
2021-03-17 19:25:51 +01:00
Simon Sessingø 891c2092eb Changed codestyle to match the rest 2021-03-17 19:25:18 +01:00
Simon Sessingø 845ef9db69 Merge pull request #450 from RedooNetworks/master
Fix warning, because of wrong calculated cookie expiration timestamp
2021-03-17 19:17:01 +01:00
Simon Sessingø ce3a2014d1 Merge pull request #449 from jatubio/patch-4
Fix 'must be an instance of Closure, array given' error when $closure is a object method.
2021-03-17 19:12:00 +01:00
Simon Sessingø 27cd8b8a1f Added support for objects like array etc as default-value. Value is now less strict. 2021-03-17 15:43:00 +01:00
Alex Blackham 93c0622b9d Altered variable name in foreach to be less ambiguous. 2019-06-21 10:45:57 +01:00
Alex Blackham 572ba1695b The input()->all method will now set every key specified in the filter. If the key doesn't exist it will be set to null. 2019-06-21 10:44:31 +01:00
Stefan Warnat 11df7ca18c Fix warning, because of wrong calculated cookie expiration timestamp 2019-02-09 11:04:07 +01:00
Juan Antonio Tubio b21feca1fc Update IClassLoader.php
Fix 'must be an instance of Closure, array given' error when $closure is a object method.
2019-02-08 21:40:04 +01:00
Juan Antonio Tubio 2a3238f30a Update ClassLoader.php
Fix 'must be an instance of Closure, array given' error when $closure is a object method.
2019-02-08 21:36:58 +01:00
Simon Sessingø d601e8eca3 Bugfixes and optimisations.
- Fix for __invoke methods (issue: #429)
- Fixed not being able to parse body of PUT request.
- BaseCsrfVerifier expects the field name to be "csrf-token" (issue: #432)
- Minor optimisations
2018-11-25 00:44:20 +01:00
Simon Sessingø 4a8b71a0b5 Merge pull request #430 from Tahrz/master
fix for __invoke methods (if there are only in class (Action))
2018-11-25 00:27:54 +01:00
Matheus d4a6d504b1 Set HTTP method before initializing InputHandler
This is needed because without it the InputHandler doesn't know which http method is being used, and because of that it can't parse the body of a PUT request
2018-11-10 22:16:45 -02:00
Taras Victorovich 9e3b1b6baa fix for __invoke methods (if there are only in class (Action)) 2018-10-02 15:40:26 +03:00
Simon Sessingø 0ac7fd559a Optimizations
- Settings parameter in group method are no longer optional.
- Updated README to contain PHP JSON-extension under requirements.
- Updated composer.json to include php json extension.
2018-08-31 01:40:21 +02:00
Simon Sessingø 5c2a973214 Merge branch 'v4-development' into v4-optional-character-fix 2018-08-24 17:23:33 +02:00
Simon Sessingø a7cbacbde7 Fix for issue #421: Incorrectly optional character in route 2018-08-24 17:16:02 +02:00
Simon Sessingo 4d842d0583 Fixed returning empty array when positing json (issue #413) 2018-04-22 05:35:15 +02:00
Simon Sessingø 8653bfa86f Development
- Fixed 403 not allowed exception is now thrown as NotFoundHttpException.
- Added REQUEST_TYPE_HEAD to Route class.
- Minor optimizations.
2018-04-06 19:44:30 +02:00
Simon Sessingø b8cfc4eb0b Fixed default parameter for all method allowed to by empty. 2018-04-06 18:01:49 +02:00
Simon Sessingø 5db4621831 Added methods for adding get, post and file parameters manually. 2018-04-06 18:00:59 +02:00
Simon Sessingø d38f81836d Development
- Added new Redirect method to SimpleRouter class.
- Changed method-names in InputHandler for better description.
- Fixed return-types for InputHandler for collections.
- Added unit-tests for InputHandler (get, post).
- Optimisations.
2018-04-06 17:20:00 +02:00
Simon Sessingø 30a2ddeed9 Development
- Added new event when adding route.
- Added `prependUrl` method to `LoadableRoute` class.
- Added unit-test for add-route event.
- Updated documentation to reflect new changes.
2018-04-02 14:53:36 +02:00
Simon Sessingø 17a7b28e82 Fixed exists method in InputHandler returning incorrect value. 2018-04-01 04:26:48 +02:00
Simon Sessingø 1dc88d23e1 Bugfixes and optimizations
- Fixed `hasParam` not working returning expected value in `Url` class.
- Chained the remaining methods in the `Url` class.
- Simplified `removeParam` method in `Url` class.
- Added new `removeParams` method to `Url` class for removal of multiple params.
2018-04-01 03:02:21 +02:00
Simon Sessingø 53f0b7d8e2 - Fixed getName method in LoadableRoute class can contain nullable value. 2018-03-30 06:47:27 +02:00
Simon Sessingø 833961ddc3 Fixed getError in InputFile returning string instead of int. 2018-03-30 05:37:04 +02:00
Simon Sessingø ce63e247b1 Bugfixes
- Fixed `Url` not outputting correct class when used in json_encode.
- Fixed `IInputItem` being too strict about strings which may be nullable.
2018-03-30 05:22:41 +02:00
Simon Sessingø 80a42030ea Bugfixes
- Fixed getting specific input-value by request-method in InputHandler.
- Added .idea files
2018-03-29 23:47:27 +02:00
Simon Sessingø 17471a53cd Removed namespace from groups 2018-03-29 23:28:03 +02:00
Simon Sessingø da219d0b19 Bugfixes
- Fixed rewrite from ExceptionHandler sometimes not working correctly.
- Fixed default-namespace for Group and partial groups.
2018-03-29 23:13:56 +02:00
Simon Sessingø a11595fb86 Bugfixes
- Fixed `$methods` argument not properly passed in `InputHandler` class.
- Updated helpers.php with latest changes.
2018-03-29 22:17:53 +02:00
Simon Sessingø e6db83c97a Fixed defaultValue issue in getValue method in InputHandler class. 2018-03-29 21:44:41 +02:00
Simon Sessingø af2ac6031d Development
- Added dependency injection support.
- Added php-di composer dependency.
- Added `ClassLoader` class.
- Added `IClassLoader` interface.
- Added unit-tests for dependency injection.
- Updated documentation to reflect new features.
2018-03-29 21:16:02 +02:00
Simon Sessingø f5a023117a Development
- Added event-arguments data.
- Added event-arguments to the event list in documentation.
- Fixed missing exceptions thrown in phpDocs.
- Added unit-tests for new event functionality.
2018-03-29 18:51:28 +02:00
Simon Sessingø a9c03f9271 Development
- Updated `helpers.php` and helpers example in documentation.
- MalformedUrlException is now handled properly by Router to avoid phpStorm syntax highlights in routes.
- Added `getUrlCopy` to `Request` class, used to clone the current route (to keep domain etc.)
- `setUrl` in `Request` are now strict and requires `Url` object and no longer accepts strings.
- Renamed `hasRewrite` property to `hasPendingRewrite` in `Request` class.
- Renamed `hasRewrite` and `setHasRewrite` methods to `hasPendingRewrite` and `setHasPendingRewrite` in `Request` class.
- Added better usage of `Url` class. When calling `url` you can now use the methods on the `Url` class to filter params, get relative/absolute url etc. See documentation for more info.
- Renamed `get` method to `getValue` in `InputHandler` class.
- Renamed `getObject` to `get` and removed `$defaultValue` argument in `InputHandler` class.
- Optimized `InputHandler` class.
- Fixed issue with `$token` not being proper string in `BaseCsrfVerifier` when token is not found.
- Added php.ini configuration settings to `setcookie` in `CookieTokenProvider` for improved security.
- Added `$router` parameter to `boot` method in `IRouterBootManager` which allows for further manipulation of the router within the bootmanager.
- Renamed `$processingRoute` property to `$isProcessingRoute` in `Router` class.
- Fixed `reset` method not resetting CSRF-verifier in `Router` class.
- Moved `arrayToParams` helper-method from `Router` to `Url` class.
- Began to add Event-functionality to router.
- Added `addEventHandler` method to `SimpleRouter` class.
- Moved `Pecee\SimpleRouter\Handler\CallbackExceptionHandler` to `Pecee\SimpleRouter\Handlers\CallbackExceptionHandler`.
- Moved `Pecee\SimpleRouter\Handler\IExceptionHandler` to `Pecee\SimpleRouter\Handlers\IExceptionHandler`.
- Added Events section to documentation.
- Added more information on url-handling in documentation.
- Optimisations.
2018-03-29 18:17:42 +02:00
Simon Sessingø ef4582dbe0 Fixed wrong return-type in loadClass. 2018-03-27 01:11:44 +02:00
Simon Sessingø 085f98cf08 Development
- Better php7 support.
- Added easier way to debug router.
- Improvements and bugfixes.
- Updated documentation.
2018-03-26 23:43:27 +02:00
Simon Sessingø f23d569757 Added support for PHP7 2018-03-20 03:38:55 +01:00