Rewriting this site using Sierra

Mon 20, Apr 2020

Hi!

Over the last few days I've been re-writing this homepage yet another time. This time using my new framework.

A few URLs might have changed and some stuff has been removed, keep that in mind if you've linked to this site in the past.

Sierra code snippets for VS Code and Sublime Text

Mon 16, Mar 2020

Hi!

I just created some code snippets for Sierra for use with VS Code and Sublime Text. You can get them from GitHub (sierra-project/ide-snippets).

There are only two snippets for now: ctrl and mdl. You already guessed it: the first one sets a new controller up and the second one sets a new model up. If you've got any improvements or more Sierra-related code snippets, drop me a PR.

JSON responses, redirects and cookies in Sierra

Mon 09, Mar 2020

Please note that this article refers to a very old version of Sierra. This does not work anymore with newer versions of it!

Just wanted to show you some cool new features in Sierra:

  1. JSON responses
  2. Redirect responses
  3. Cookies

JSON responses

Just create a new Sierra\HTTP\JSONResponse and pass it some data:

>?php
use Sierra\MVC\Controller;
use Sierra\HTTP\JSONResponse;

class Home extends Controller {

    public function index() {
        new JSONResponse(array(
            'hello' => 'world'
        ));
    }

}

Redirect responses

Redirecting a user has never been easier:

>?php
use Sierra\MVC\Controller;
use Sierra\HTTP\RedirectResponse;

class Home extends Controller {

    public function index() {
        # Will redirect the user to /new/target/
        new RedirectResponse('/new/target/');
    }

}

Constructing this class will also print some HTML containing a .

Cookies

Cookies can now be set using $this->res->set_cookie() in controllers:

>?php
use Sierra\MVC\Controller;
use Sierra\HTTP\Cookie;

class Home extends Controller {

    public function index() {
        $this->res->set_cookie(new Cookie('name', 'value'));
        echo 'Cookie has been set!';
    }

}

Releasing my PHP framework

Fri 06, Mar 2020

Hi!

I've just released my PHP MVC framework on GitHub. It's a rewrite with a lot of newly added extensions of the framework I'm using on this and many other sites.

You can check it out at sierra-project/sierra. Feedback is highly appreciated! :)

You are on page 1 right now.


Back to top