Profile cover photo
Profile photo
A PHP MVC Framework
A PHP MVC Framework


Post has attachment
Roll your own Escher project with Git

A long-term goal for Escher is to make the software self-updating. Eventually, you will be able to check for and apply updates from an admin console.

However, Escher's developers are big fans of Git and GitHub. As such, we wanted to provide an easy way to create a project using Escher and keep it up-to-date with Git. This used to be quite a chore--we tried approaches using symbolic links, using four or five repositories in concert, and one approach that totally trashed +Andrew Detwiler's issue tracker. Sorry, Andrew!

Now, it's super simple. Just fork or clone the "escher-project" repository. This is a special repo that's automatically generated from the latest version of Escher. It uses git submodules to separate Escher code from your application code, and it creates short, distinct commit messages to keep its footprint on your git history to a minimum.

Check out the "escher-project" repo on GitHub for more information:
Add a comment...

Post has attachment
Scrapbook Photos
Add a comment...

Meet Escher, Part 1: Routing Requests
by +Thom Stricklin

Albert Einstein once said: "Make things as simple as possible, but no simpler." With any luck, this is something that I have achieved with the Escher PHP framework.

Escher is a relatively small framework--approximately 10,000 lines of code (ignoring included libraries). My hope for Escher is that it accomplishes a few key things very well, without doing anything else poorly, and while remaining simple enough for a developer to use without a steep learning curve. I will be writing a series of posts about the things Escher does well... This, hopefully, will evolve into the end-user documentation for the framework.

Requested URLs

One of the things Escher does well is routing requested URLs. Escher deals exclusively with "clean" URLs like the following:

This URL looks just like a folder sitting on the web server--and if you were maintaining a website using FTP and static files, that would be precisely the case. Escher, however, instead sees this URL as a virtual "route". The tool in Escher that interprets this URL--and also provides various URL-building and traversing functionality--is a helper known as the "router".

Static Routes

In its simplest form, the router compares the requested URL against static routes defined in the Escher configuration. Here's an example:

$static_routes = array(
'hello/world' => array('controller' => 'page','model_id' => 1),

A request to would match this static route, and Escher would know to load the page controller in order to display page #1. This is a very simple example, and not very desirable because, for each "page" of content we create, we must make a change to the config file.

A more powerful example might be a blog. Here's what it would look like to add a blog to our static routes:

$static_routes = array(
'hello/world' => array('controller' => 'page','model_id' => 1),
'blog' => array('controller' => 'blog'),

A request for would match this route, and Escher will pass the request to the blog controller. The remainder of the requested URL, article/hello-world, gets passed to the controller as a set of arguments. The router doesn't have to understand what these arguments mean--the blog controller itself should understand to display the article matching "hello-world".

This is the true strength of Escher's router--it doesn't need to understand the request. It only needs to know which code to send the request to--the controller code that will understand the request.

This functionality is actually fairly common across MVC frameworks and other content management systems... but it is one of the things that Escher does well.

Dynamic Routes

For more complex websites, Escher allows the creation of dynamic routes. These routes are database-driven and are arranged in parent-child relationships. Each segment of a URL may represent a different node of a dynamic route.

In this example, "about", "thom", and "contact" are all dynamic routes. Each of these routes will point to a particular controller, and each may refer to a different piece of content.

Unlike static routes, these routes are related to each other: "thom" is a child of the "about" route, and "contact" is a child of the "thom" route. This makes it easy to manage large sections of a website at once. Rename the "about" route, and the URLs that point to "thom" and "contact" change as well. Delete the "thom" route, and "contact" is automatically deleted.

Mix and Match

A nice feature of Escher is that static and dynamic routes can co-exist, as the router can handle both types. This has good practical value from a developer standpoint--if you are a custom website using escher, you may want to configure static routes to your custom controllers, but you might want to make your help and about sections dynamic routes so they are easier to create, maintain, and build upon.
Add a comment...

Post has attachment
Welcome to the Escher page on Google+

Escher is an open-source web application framework in PHP. Escher is loosely based on the Model-View-Controller (MVC) and Heirarchical MVC patterns and provides generous support for plugins and other extensibility.

Escher is currently a work in progress. The framework is still heavily undocumented.

Escher was developed by +Thom Stricklin with contributions from +Andrew Detwiler.
Add a comment...
Wait while more posts are being loaded