Skip to content

Releases: nova-framework/framework

Multi-Method Route Match

28 Mar 21:08
Compare
Choose a tag to compare

Introduce a Multi-Method Route Match, extremely useful when dealing with CRUD forms, while is wanted to specify punctually the valid request methods.

Usage:

Router::match(['get', 'post'], 'admin/users/(:num)/edit', 'App\Controllers\Admin\Users@edit');

Or, in the ClassicRouter case can be:

Router::match(['get', 'post'], 'admin/users/(:num)/edit', 'admin/users/edit/$1');

Release of 3.0

27 Mar 06:37
Compare
Choose a tag to compare

With version 3.0 files are served by default above the document root, the key changes are as follows:

Routing images / js / css files

From within Templates your css/js and images must be in a Assets folder to be routed correctly.
This applies to Modules as well, to have a css file from a Module the css file would be placed inside nova/app/Modules/ModuleName/Assets/css/file.css.
Additionally there is an Assets folder in the root of nova this is for storing resources outside of templates that can still be routed from above the document root.

Router

##Optional parameters

New to 3.0 is allowing filters to be optional

Filters written like (:any) are required to match the route but writing a filter as (/(:any)) makes it optional.

This route supplied with Nova has one filter that is required then a further 3 optional filters. Multiple filters should be inside the first parenthesis.

Router::any('admin/(:any)(/(:any)(/(:any)(/(:any))))', 'App\Controllers\Demo@test');

##Groups

new to 3.0 is groups routes can now placed in a group, this allows all routes within the group to inherit the group name

Router::group('admin', function() {
    Router::any('add', 'App\Controllers\Demo@cool');
    Router::any('settings', 'App\Controllers\Demo@nice');
});

Is the equivalent to

Router::any('admin/add', 'App\Controllers\Admin@add');
Router::any('admin/settings', 'App\Controllers\Admin@settings');

Error Log

The error log is no longer a .html file but rather a log file. On a production server it should be outside the document root, in order to see the any errors there are a few options:

  • Open app/logs/error.log
  • OR open system/Core/Logger.php set $display to true to print errors to the screen
  • set $emailError to true and setup the siteEmail const in app/Config.php this relies on an email server (not provided by the framework)

##Namespace change

classes in app/Controller app/Model and app/Modules now have a namespace starting with App:

  • App\Controllers
  • App\Models
  • App\Modules

That is only for classes within app, this is not needed for classes within system.

Aliases for helpers within views

Helpers can now be used without using a use statement, inside system/Core/Alias contains an array of helpers with their alias allowing helpers to be used directly.

Instead of doing:

use Helpers\Session;

Session::set('item', 'value');

it can become:

Session::set('item', 'value');

New / Updated Helpers/Methods

Url

resourcePath()
The basic idea is to provide a lowercase version of the resource path for the resources located in Modules and the base assets folder. Then the following call:

$path = Url::resourcePath('FileManager');

will result into:

/modules/file_manager/assets/

With no parameters will return:

/assets/

Which correspond with the generic Assets directory.

detectUri()

Returns the current url.

templatePath() and relativeTemplatePath()

Now accepts 2 parameters:

  1. $custom - default to TEMPLATE which is the template being used
  2. $folder - folder to return from within the template defaults to Assets

Assets

The assets helper loads css and js files both methods have the following parameters:

  • $files - a single file or array of file paths
  • $cache - cache the output default to false, a minified file will be generated in the theme css/js folder.
  • $refresh - update the cache default to false
  • $cachedMins - time in seconds to keep the cache for defaults to 14400

Csrf

Updated makeToken() and isTokenValid() to require a name parameter, this allows using multiple times on a single page with unique names.

Data

create_key() has been renamed to createKey()

Form

Form::open by default created a hidden input with a token to be used for cross site request forgery checks (CSRF) if a name is passed to Form::open it's used as part of the token name.

Inflector

Inflector is a doctrine class to allow transforming file paths used within the Url helper.

JsMin

Minifies supplied js code

Request

get() method added.

ReservedWords

This class has a method getList which returns an array of reserved words include PHP 7's reserved words.

Response

This helper is primary used for routing, see the Response page for more details.

Release of 2.2

18 May 13:36
Compare
Choose a tag to compare

Version 2.2 now fully supports PSR (PHP Standard Recommendation)

The most noteworthy changes are:

Full PSR 1 & 2 compatibility - Folder that contain classes now start with a capital letter
Coding standards have been applied to all classes to adhere to the PHP Standard Recommendation (PSR)

PSR 1 - Basic Coding Standards- docs found at http://www.php-fig.org/psr/psr-1
PSR 2 - Coding Style Guide - docs found at http://www.php-fig.org/psr/psr-2

Docs have been updated for 2.2

2.1 Final Release

18 May 08:23
Compare
Choose a tag to compare

This release is a snapshot of the 2.1 and all its commits in preparation for 2.2 to be released.

V2.1 Release

26 Jun 20:32
Compare
Choose a tag to compare

This beta release has changed the following:

Namespaces added
Integration with Composer
Config is now a class called by the core/controller class
loadModel and loadHelper calls no longer needed due to namespacing
autoloader file removed in favour of namespace autoloading with composer

website documentation has been updated.
Feedback is really useful in ironing out any bugs and to make improvements a forum thread is ready to receive user feedback. http://simplemvcframework.com/forum/viewtopic.php?f=3&t=2022

v2.0 Released

13 Apr 10:32
Compare
Choose a tag to compare

Version 2 has been released, their has been significant changes made to the framework, all have been documented on the updated website (http://simplemvcframework.com)[http://simplemvcframework.com]

The most noteworthy changes are:

Routes added
Ability to nest models, helpers and controllers
Introduced a config file for initial setup
Slimmer index file with autoloading