Commit Graph

40 Commits

Author SHA1 Message Date
Simon Sessingo
a25be983b8 Development
- Renamed Uri class to Url.
- Renamed setUri and getUri to setUrl and getUrl.
- Added custom Exceptions and ensured that router only throws HttpExceptions.
- Added isAjax method to Request class.
- Added better phpDocs.
- Other minor optimisations.
2018-02-26 23:21:26 +01:00
Simon Sessingo
50c6499efb Simplified url-rewriting and callback handling. 2018-02-24 05:35:05 +01:00
Simon Sessingo
4d2b584936 Fixed parameter default-value being overwritten (issue: #347). 2018-01-06 03:27:27 +01:00
Simon Sessingø
a5aac57ce9 Added RoutePartialGroup support. 2017-09-03 18:24:51 +01:00
Simon Sessingø
7f924c7d0a Added RouterGroupTest unit-tests. 2017-09-03 16:49:15 +01:00
Simon Sessingø
9f509ac818 Added unicode parameter regex support. 2017-08-23 22:49:35 +01:00
Simon Sessingø
65c811356d Fixed url parsing for unicode characters. 2017-08-23 21:04:11 +01:00
Simon Sessingø
b7f5d31544 Fixed double / when calling findUrl on routes with the first
parameter optional.
2017-08-17 23:31:27 +01:00
Simon Sessingø
74187ee326 Fixes and development
- `$parameter` argument in `findUrl` method now supports both string,
array and null value to avoid confusion.

- Using return value in callbacks now displays value (issue: #257)
2017-08-13 03:06:27 +01:00
Simon Sessingø
62f0075cf3 Fixed wrong url matching on some paths (issue: #253 - thanks @alejoloe007jb) 2017-08-07 22:18:36 +02:00
Simon Sessingø
883d8a6b0e Fixes for issue #248 2017-08-01 21:09:18 +02:00
Simon Sessingø
3a7b27796a Url matching fixes 2017-08-01 18:29:47 +02:00
Simon Sessingø
b07348a3df Development
- Removed temporary `RouterException` class.
- Added object-types to parameters in `CallbackExceptionHandler` and `SimpleRouter` classes.
- Router now renders groups even if callback is null.
- Renamed `setMiddleware` to `addMiddleware` in `Route` class and `IRoute` interface.
- `addMiddleware` now accept both object and class strings in `Route` class.
- `addExceptionHandler` now accept both object and class strings in `RouteGroup` class.
- Added unit-test for rewrite-exception message change: `testRewriteExceptionMessage` in `RouterRewriteTest`.
- Fixed typo: renamed `testSimularUrls` to `testSimilarUrls` in `RouterUrlTest`.
2017-07-08 11:21:18 +02:00
Simon Sessingø
ca381d445f Development
- Changed router so it supports both string and object as exception handlers.
- Added `Router::error($callback)` method to `Router` class (issue #238).
- Fixed issues calling `getController` and `getMethod` when callback is an object (issue #239).
- Updated documentation to reflect new changes.
- Added `addExceptionHandler` to `IGroupRoute` interface and `RouteGroup` class.
- Other minor bugfixes and optimisations.
2017-07-06 15:25:04 +02:00
Simon Sessingø
9dd80dd1d9 Development
- Fixed global regex match not working properly.
- Feature: added option to change regular expression used for parameters on routes.
- Added unit-tests for custom parameter regular expression.
- Updated documentation to reflect new features.
2017-05-09 06:43:26 +02:00
Simon Sessingø
50e8926272 Added .htaccess example to documentation (issue #232) 2017-05-09 02:31:01 +02:00
Simon Sessingø
0a58d36606 Development
- Fixed: `RouteController` not matching certain urls.
- Made `RouteResource` more strict in url-matching.
- Added PHPUnit `RouterControllerTest` class.
- Fixed merged `testSimularUrls` method in `RouterUrlTest`.
2017-03-06 02:53:44 +01:00
Simon Sessingø
db024b9588 Added simular routes PHPUnit test 2017-03-06 02:21:13 +01:00
Simon Sessingø
ff3f1bdcdd Development
- Fixed issue #227 causing custom resource-routes not to be loaded after latest update.
- Optimized `RouteResource` class.
- Renamed `IRestController` to `IResourceController`.
- Added unit-tests for RouterResource.
- Simplified unit-tests with the `TestRouter` custom router class.
2017-03-05 17:09:46 +01:00
Simon Sessingø
ce276bd5b7 Version 3
- Easier rewrite management.
- Optimisations.
- Updated documentation.
2017-02-09 13:18:05 +01:00
Simon Sessingø
523d49359b Development
- Fixed where method calling itself instead of setWhere.
- Added unit-tests for regex.
2017-01-19 18:40:47 +01:00
Simon Sessingø
d9b97ccf42 Bugfixes 2016-11-28 04:20:34 +01:00
Simon Sessingø
6213f2fb75 Development
- Optimised Input-classes.
- `get` and `getObject` methods on `Input` now supports filtering on multiple method-types when using the `$method` parameter.
- Input classes now know how to parse that stupid nested $_FILES array.
- It's now possible to change method-names on ResourceControllers.
- Removed `getValue` and `setValue` from `InputFile` classes.
- Ensured that request-method are only parsed from $_POST or $_SERVER.
- Fixed minor parameter-issues with subdomain routing.
- Added PHPDocs.
- Added even more unit-tests.
- Many small optimisations tweaks.
2016-11-26 04:30:00 +01:00
Simon Sessingø
dfd32c0904 Bugfixes
- Moved middleware stuff back to Route class.
- Fixed Tests not working due to invalid method.
- Updated depricated method-calls in demo-project.
2016-11-21 04:06:45 +01:00
Simon Sessingø
8370d3d94e Development
- Made easier to extend.
- Added IRoute class.
- Changed namespace for Route classes.
- Moved find-url related stuff to Route classes itself.
- Added more tests for finding urls.
- Added support for custom names on RouteController and RouteResource.
- Removed depricated methods.
- Updated documentation.
- Updated demo-project to reflect changes.
- Other small bugfixes and improvements.
2016-11-21 01:50:28 +01:00
Simon Sessingø
7e63197252 Major overhaul 2016-11-19 19:24:05 +01:00
Simon Sessingø
808d59d3d3 Bugfixes 2016-11-19 08:46:48 +01:00
Simon Sessingø
ed1ac74e7a Development
- Fixed updatae causing middlewares to sometimes load on wrong routes.
- Converted project to PSR/2.
- Updated InputCollection class and added get method for easy access to values.
- Complete refactor of RouterBase.
- Added findRoute method to RouterBase.
- It's now possible to change parameter modifiers and symbol by overwriting properties on RouterBase.
- Added RouterUrlTest unit-test for testing route-urls.
- Added IRestController that can be easily implemented in custom ResourceController-classes.
- It's now possible to use "-" instead of "_" when using getHeader method in Request class.
- Added PHPDocs.
- Fixed "/" route sometimes returning "//" as url.
- Optimisations and bugfixes.
2016-11-19 02:48:19 +01:00
Simon Sessingø
c59ab12e1a Bugfixes 2016-11-17 05:36:44 +01:00
Simon Sessingø
73ee4521bc Bugfixes
- Array arguments are now longer automaticially merged.
- Added domain-route parameter unit-test.
2016-11-17 03:50:33 +01:00
Simon Sessingø
75566dc2ba Bugfixes 2016-11-16 15:15:51 +01:00
Simon Sessingø
9513e38009 Fixed to unit tests 2016-11-15 05:57:04 +01:00
Simon Sessingø
d5e7a13d89 Development + bugfixes 2016-11-15 03:43:26 +01:00
Simon Sessingø
8740db9582 Development
- Isolated Http classes from router.
- Removed getInstance from Request object - current router request should now be obtained through SimpleRouter::request().
- Fixed broken test cases.
- Added test for regular expression match.
- Updated documentation to reflect changes.
- Added more helper examples to documentation.
- Added helpers to demo-project.
- Optimisations.
2016-11-07 04:40:28 +01:00
Simon Sessingø
98cc8504d4 Development
- Group only loads if prefix matches (if any).
2016-11-06 08:13:47 +01:00
Simon Sessingø
a8620cbc70 Updates
- Simplified exception-handling (see demo project for examples).
- Optimised sample-project.
- Optimised and added further unit-tests.
- Optimised and bugfixes.
2016-10-20 08:31:21 +02:00
Simon Sessingø
53e5b5362f Development
- Enhanced regular expression used for matching parameters.
- Added basic unit-tests for parameters.
- Fixed typos in PHP-docs and other minor optimizations.
2016-06-04 18:20:46 +02:00
Simon Sessingø
6780b24e59 Development
- Optimized the way parameters are parsed as a result, simple-router now supports routes like `/{param1}-{param2}.json`.
- Replaced reg-ex for parameter-matching with `\w` which means that default parameter matching on routes now include `_` (underscore) per default.
- Simplified `MiddlewareTest` class.
2016-06-04 15:12:04 +02:00
Simon Sessingø
457dbc5710 [BUGFIX] Fixed issue #83
- Added more tests.
2016-04-09 07:51:03 +02:00
Simon Sessingø
fc4fd0edf1 [FEATURE] Added ExceptionHandling functionality + tests.
- Somehow the ExceptionHandling functionality never really get implemented and/or got lost in translation, it's back whup!
- Added some basic tests for Middleware + routing.
2016-04-09 07:05:49 +02:00