Limonade

Nov 30

Limonade 0.4.6 is available

Changes:

I have updated Wikir and the blog example. Please update your code!

Nov 27

Just a little tip for Limonade contributors: the current development branch is 0.5. So you should fork it instead of master, which is still in 0.4.

Thanks!

Nov 17

Hidden features

I’ve planned for a while the ability to call objects methods in dispatch_* functions. Useful if you want to group your controller functions in a class for example (or simply for those who can’t write a PHP project without having a class keyword in each file).

I’ve added Matěj Grabovský’s commit that adds support for dispatching to lambda functions/closures in the new 0.5 branch; and i forgot that it also “activates” the dispatching objects methods features!

Because we use call_user_func() to call our controller function, our parameter is a callback function, and can also be object methods, including static clas methods and lambda functions.

So now we can write

# will call my_hello_function() function
dispatch('/hello', 'my_hello_function');

# Static class method call, MyClass::hello();
dispatch('/hello', array('MyClass', 'hello'));

# Object method call, $obj->hello();
dispatch('/hello', array($obj, 'hello'));

# Static class method call (As of PHP 5.2.3), MyClass::hello();
dispatch('/hello', 'MyClass::hello');

# Using lambda function (As of PHP 5.3.0)
dispatch('/hello', function(){
  return 'Hello World!';
});

PS: thanks to datashaman for noticing it

Oct 24

I’ve upgraded those examples with Limonade 0.4.5:

Oct 17

Limonade 0.4.5 is available

See changes. This a maintenance release with some bug fixes.

I’ve also updated the README files with some notes about Url rewriting.

Now i can start to work on 0.5 and new features ;-)

Oct 15

Sep 19

CSRF protection

Too many spam in the Wikir demo !!! So I finally decided to update it with a CSRF protection that i developped for Vincent Hélye’s portfolio. This is not a perfect solution but it’s first step to fight against those nasty spams.

This little set of functions will be the first one of a serie that I call “Lemons”. Lemons can be seen as loose coupled extensions for Limonade. I will initiate a git repository for lemons in a few days, but you can already check lemon_security.php in the wikir example

Sep 13


minimalmac: from www.frankchimero.com (via Rands)

minimalmac: from www.frankchimero.com (via Rands)

Aug 05

From 0.3 to 0.4, new Limonade features

You’ll find all changes in the CHANGES file, but let’s have a quick look to some new features:

Session features

Session starts automatically by defaut. Then you can access session variables like you use to do, with $_SESSION array.

You can disable sessions with the session option.

see snippet example

Flash features

Flash is a special use of sessions. A flash value will be available only on next request and will be deleted after. It’s very useful to raise errors on a form or to notice a successful action.

This is the same behaviour as in Rails, and the syntax is very closed to it:

see snippet example

Url rewriting support

Limonade now support url rewriting for beautiful urls.

With a .htaccess in your app folder

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  Options +Indexes
  RewriteEngine on
  # RewriteBase /my_app/ # if your app is in a subfolder

  # test string is a valid files
  RewriteCond %{SCRIPT_FILENAME} !-f
  # test string is a valid directory
  RewriteCond %{SCRIPT_FILENAME} !-d

  RewriteRule ^(.*)$   index.php?/$1    [NC,L]
</IfModule>

And setting explicitly the option('base_uri') in your configure() function:

option('base_uri', '/my_app'); # '/' or same as the RewriteBase in your .htaccess

You can access your site with urls like http://your.new-website.com/my/limonade/path instead of http://your.new-website.com/?/my/limonade/path.

Errors redesign

Enjoy your errors! (screenshot)

Beautiful errors: the new limonade default view design, since 0.4

Beautiful errors: the new limonade default view design, since 0.4