Overview & Change Log
The Nova framework is a PHP 5.5+ MVC framework. It's designed to being lightweight and modular, allowing developers to build better and easy to maintain code with PHP.
To this end Nova does not come with lots of built in libraries/helpers or modules instead, it's left to the user to Deci De they want to implement, this allows freedom to design and build how do you see fit.
The base framework however does come with a range of helper classes. New classes can easily is added at any stage of development.
This have been tested with PHP 5.6 and PHP 7 for any bugs.
Routing images/js/css Files
From within Templates your css/js and images must is in a Assets folder to be routed correctly. This applies to Modules as well and to has a CSS file from a Module the CSS file would is placed inside Nova/app/modules/mod Ulename/assets/css/file.css. Additionally there is a Assets folder in the root of Nova this is for storing resources outside of templates that can STI ll be routed from above the document root.
Routeroptional Parameters
New to 3.0 are allowing filters to be optional
Filters written like (: Any) is required to match the route but writing a filter as (/(: any)) makes it optional.
This route supplied with Nova have 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\[email protected]‘);
Groups
New to 3.0 are 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\[ Email protected] ' router::any ( ' settings ' ' app\controllers\[email protected] ' ) ; })
is the equivalent to
Router::any(‘admin/add‘, ‘App\Controllers\[email protected]‘);Router::any(‘admin/settings‘, ‘App\Controllers\[email protected]‘);
Error Log
The error log is no longer a. html file but rather a log file. On a production server It should is outside the document root, in order to see the any errors there is 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 e-mail server (not provided by th E framework)
Namespace Change
Classes in App/controller App/model and App/modules now has a namespace starting with app.
- App\controllers
- App\models
- App\modules
That is the only for classes within app, which is not a needed for classes within system.
Aliases for helpers within views
Helpers can now is used without using a USE statement, inside System/core/alias contains an array of Helpers with their AL IAS 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/methodsurl
ResourcePath () The basic idea was 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‘);
would result into:
/modules/file_manager/assets/
With no parameters would return:
/assets/
which correspond with the generic Assets directory.
Detecturi ()
Returns the current URL.
TemplatePath () and Relativetemplatepath ()
Now accepts 2 parameters:
- $custom-default to template which is the template being used
- $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 would 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 () have been renamed to CreateKey ()
Form
Form::open by default created a hidden input with a token to is used for cross site request forgery checks (CSRF) if a Nam E 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 have a method getList which returns an array of reserved words include PHP 7 ' s reserved words.
Response
This helper was primary used for routing and see the Response page for more details.
Overview & Change Log