Skip to content

Releases: mvc5/mvc5-application

Middleware Args

20 Aug 16:57
Compare
Choose a tag to compare

The Middleware pattern now accepts multiple varied arguments. The next delegate function is appended to the list of arguments passed to each Middleware function. Unless the Middleware function returns early, the last argument passed to the last delegate function is returned as the result; otherwise null is returned. This allows Middleware functions to be easily created and for them to vary the arguments passed to the next function. The route match Middleware class has been removed and a new HttpMiddleware class has been created so it can be called with named arguments for the request and response.

The Middleware web controller now separates its workflow from the request controller by no longer passing its delegate function to the controller.

The event system now correctly implements the Iterator pattern.

The named arguments args parameter has been renamed to argv. This allows it to be reserved as the list of remaining named arguments similar to a variadic argument. When argv is used as a variadic argument, the list of remaining named arguments is stored in a SignalArgs class that the function can use to retrieve the remaining named arguments.

Static helper methods have been added to the context service class. The call function can be used with named arguments. The param method retrieves a configuration value. The plugin method returns a service value. The __callStatic method proxies to the call method but does not use named arguments.

The configuration constructor method has been moved to a base trait so it can be used separately by other classes such as the new Iterator class.

Nexus - Immutability, RFC 3986

24 May 22:29
Compare
Choose a tag to compare

The route, request, response, headers and view models are now immutable by default. This has introduced the ability for Models to be either immutable, a configuration or an overloaded class and in some cases can be used interchangeably.

The url route generator now RFC 3986 encodes urls but keeps some characters unchanged for readability, e.g square brackets for php query strings. The url generator can also create urls without a route configuration by prefixing the path with a forward slash. Child routes of the current parent route can now have the parent parameters automatically injected.

The view template renderer function can now render templates without a view model service configuration by prefixing the template path with a directory separator. Because the layout model is now immutable, polymorphism can be used to create a shared layout class that overrides the immutable with and without methods to prevent the class from being cloned; an example is in the demo application.

Request headers now keeps the host header first on the list and names are converted to lowercase to support case-insensitive usage.

The model set, remove, with and without methods now accepts an array of key values. This allows the with and without methods to only require a single clone operation.

The documentation has also been updated https://mvc5.github.io.