Skip to content

Releases: mvc5/mvc5-application

Post Form

23 Jun 17:37
Compare
Choose a tag to compare

Fix form post controller test.

Invoke Plugin

14 Jun 21:28
Compare
Choose a tag to compare

The invoke plugin now automatically resolves the returned value.

JSON API

10 Jun 18:13
Compare
Choose a tag to compare

JSON requests and responses are now automatically supported. A request with the application/json content type header is decoded automatically (JIT) into an associative array and assigned to the request as the data attribute. If the route match middleware function returns a HTTP Error, e.g 404 Not Found, it is assigned to the request by the router. The error controller will then return the HTTP Error as a JSON Response when the request accept header is application/json. Similarly, when an exception is thrown, the response\exception function will return a JSON Response containing an empty exception message. Alternatively, in development, the debug configuration parameter can be set to true to include the details of the exception.

Two JSON request and response tests have been added. One uses the Guzzle HTTP Client and the other directly instantiates the applications and runs the request. Each test verifies the returned response.

Example Redirect and Page plugins have also been added.

Overview (documentation)

16 Apr 16:07
Compare
Choose a tag to compare

Updated overview documentation.

Nullable, Void and Iterable

06 Apr 22:04
Compare
Choose a tag to compare

This release is for PHP 7.1 and above. Nullable, void and iterable types have been added.

Getter methods can now return either a single value when the name is a string or an associative array of values when the name is an array of key names. In addition to the get method, multiple request params, shared services and session messages can also be retrieved.

Cookie values can now be null and will be converted to an empty string.

The throws docblock attribute has been added to methods that may throw an exception.

A bug has been fixed for when casting a HTTP URI class to a string that has an array for its query.

Overloaded objects no longer overload the get method; only the magic methods offsetGet and __get are overloaded.

The session messages API has been tidied up.

The route dispatcher now expects the routes configuration to be an iterable type. The children for an individual route must also be an iterable type. However, if the routes are also used to create URLs, then the routes configuration must also be associative.

Response emitters now return void.

The remove method now returns void.

New Template Engine, Custom String Directives

02 Jan 05:00
Compare
Choose a tag to compare

The View5 Template Engine has been updated and includes Blade 5.5 changes.

Render directives have been added similar to include directives but they do not include the parent template variables when rendering a template. Custom directives can now also be strings and tokens are available for substitution of the expression into the string. The {expression} token includes the enclosing parentheses of the directive whereas {expr} does not; the {var} token can be used as a variable name. Custom directives can be loaded using a separate configuration file. The Mvc5 Demo Application has been updated with examples.

Expect Exception Plugin

25 Sep 15:41
Compare
Choose a tag to compare

A new plugin has been added to help catch exceptions.

new Expect(new Call('web'), new Call('exception\response'), true, false)

The Expect plugin will resolve a plugin and if an exception is thrown, it will be caught and passed to the second plugin to resolve. Its third parameter indicates whether the exception should be passed to the second plugin as a named argument and its fourth parameter indicates whether to merge the exception with the arguments passed to the first plugin. This plugin has been used to replace the Mvc5\Web class.

The overview documentation has also been updated.

Maybe Nullable (Plugins)

18 Sep 16:47
Compare
Choose a tag to compare

Previously a shared service value could not be null; because the PHP function isset only returns true when the value is not null. Consequently, if a shared service previously returned null, the service would be called again the next time the shared value is retrieved. In order to resolve this, two new plugins and an empty object have been created, Maybe, Nullable and Nothing.

The Maybe plugin can be used to return Nothing when a value is null. The Nullable plugin can then be used to return null when the value is Nothing. Additionally, the Maybe plugin can be used as a null coalescing operator by configuring it to return a default value (or plugin configuration) instead of returning Nothing.

(new App)(new Maybe(null, 'foo')); //foo

Type Hints and Return Types

09 Sep 16:39
Compare
Choose a tag to compare

PHP 7.0 type hints and return types have been added. This strengthens the logic of the system and makes it easier to follow. Additionally, the null coalescing operator is used to complement nullable return types so it is possible to determine whether a value has been set and to cause an error when an uninitialized value is passed to a variable with a specific type hint, e.g. a string.

The service call method now only passes the arguments of a chained method call to the last function, e.g call('request.uri.with', ['path', '/']) will only pass the arguments to the "with" function; previously they would be passed to every function in the chain.

The service builder can now create classes with variadic constructors using named arguments.

A cookie expire time now accepts a string date format for the strtotime function, e.g '+1 day'.

A shared layout class has been added to help provide a layout that can be modified by a template.

Middleware Args

20 Aug 17:10
Compare
Choose a tag to compare

This is for the 8.0 release.