Bacon releases 0.1.1 - 0.1.5

A couple of weeks have passed since the first release of Bacon, but we did not stop working on it and have released the tags 0.1.1 to 0.1.5 for Bacon and the tag 0.1.1 for Sauce.

The full changelog can be found here.

A few of the changes are worth noting:

bacon-dist package changed

The bacon-dist composer package now requires the latest 0.1.* version so you get updates as soon as they''re released. To update your dependencies run composer update.

Redirects in a Controller''s init() method

In some cases one needs a way to escape a controller very early, e.g. if authentication requirements are not met. The init() method now sports this via redirects.

class Backend extends Application
{
    protected function init()
    {
        // $this->logged in might be defined in Application
        if (!$this->logged_in()) {
            return $this->redirect([ ''backend/login'' ]);
        }
    }
}

ORM

Most of the changes in \\Bacon\\ORM\\Model and \\Bacon\\ORM\\Collection are refactorings in terms of quality and clean code. All methods querying the database now use prepared statements and a few internal properties now use Sauce Object and Vector instead of builtin arrays.

Two changes however might affect the users of the ORM: A class \\Bacon\\Exceptions\\ValidationError has been added and the static::$timestamps property is now by default true (explicitely set so in \\Bacon\\ORM\\Model).

When calling $model_instance->error(''column'', ''message''); a new ValidationError object is created and pushed, but not thrown.

The case insensitive Router

After moving Bacon to use Composer and its PSR-0 autoloader, controller and view directories had to always start with a capital letter. The router did not care much about the case of the directories and files it searched for, so it depended on the underlying OS or file system whether it was case sensitive or not. On Windows the change to the PSR-0 autoloader did not break anything. On Linux however one had to provide uppercase resource names in the URI, which looks odd. We also did not like the possibility of introducing bugs (okay, we did actually have that bug in our applications) when working on different platforms.

So the router is now case insensitive.

Misc changes

  • The documentation now resides in the Bacon repository instead of baconphp.net''s. That way it comes with your local checkout/download of bacon and can be found in vendor/brainsware/bacon/docs. It is written in Github flavoured markdown.
  • \\Bacon\\Log now outputs timestamps formatted according to ISO 8061.
  • bin/server has been changed to run on port 8080 instead of 80 by default no longer requiring sudo.
  • \\Sauce\\CliColors has been added.