version 2.5.0 release is out. This version focuses on stablizing the entire framework with improvements made
on the window management system and how it resolves urls. The other fixes focuses on improving helper functions and some important core classes within the framework such as
Filemanager, Forms and Session classes. With the new release, the framework's documentation is now available online.
Some command-line commands were detected to have major issues. These commands include project used for creating new project applications,
config:all used for configuration of new files and the migrate command which is used for generating migration files. The errors
thrown by these methods have been successfuly resolved.
Form::castError(),
Form::castedErrors(), Form::dataval() and Form::onpost() methods. The second and third improvement is made through the introduction of
formerror() function and @formerror() template directive. These improvements are made to enable the easy handling of form validation errors.
Form::error() into a unique
storage space where it can be obtained later after a form validation has been initialized.
A sample format is shown below:
Form::model(new SampleModel);
Form::loadData((new Request)->data());
Form::isAuthenticated();
Form::castError('login');
castError() method is used to save any error response found into "sample"
unique name which can later be accessed by the Form::castedError(), formerror() or @formerror() directives.
Form::castError() method by supplying the unique name
with which the error is saved along with a unique error key name that is expected to be returned. Internally generated error keys include csrf:title,
csrf:info, mod:, index: and any:. Learn more about casted errors from
here.
Form::onpost(function() {
echo "This is a post request";
});
Form::onpost('login', function() {
echo "This is a post request with request key 'login' ";
});
Form::onpost() will look for a request key "login"
in the request data. If the key exists, the callback function will be called else, the callback will be ignored.
Form::onpost(function() {
Form::register('email', function($userinfo){
User::login($userinfo);
});
});
Form::register() function. The first argument
points to a request data key whose corresponding value is assumed to be the expected session's userid that is later used by
the User::login() to initialize a new session.
Form class is provided here.
In earlier versions of the framework, sessions were managed using the global session storage. This version has included more methods that can be easily used to manage sessions. More information about these new methods are available here.
Although, like many other frameworks, spoova favors the MVC pattern, yet the entire systems is managed
through a windows-approach which determines how routes are resolved based on three major patterns which are
root, path and base url patterns. The windows()
function is one which provides a great help when working with routes. In ealier versions of the framework, the
window() function returns the following responses when supplied with any of url patterns:
URL: http://localhost/app/ window('root'); // empty string window('base'); // empty string window('path'); // empty string
URL: http://localhost/app/index window('root'); // 'index' window('base'); // 'index' window('path'); // empty string
index page,
the responses when the index name is actually supplied is a bit different. This could
cause errors especially when working with window shutter methods. The new version of the framework introduces
a new way to address this issue by supplying the "@" symbol on the paths which are expected to be
resolved. The sample below shows how the first url will respond when the "@" character is prepeded to
the argument
URL: http://localhost/app/ window('@root'); // 'index' window('@base'); // 'index' window('@path'); // empty string
window() function is used within the window system. It is also suggested to visit
window inverse to understand how this can be applied with
the inverse operator.