News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Working with Slim Middleware
February 21, 2013 @ 09:23:24

On PHPMaster.com Timothy Boronczyk has written up a tutorial about using the Slim microframework as a sort of "middleware" in your application - a wrapper around other functionality with an easier to use interface.

Slim is a microframework that offers routing capabilities for easily creating small PHP applications. But an interesting, and powerful, feature is its concept of Middleware. [...] I've found middleware to be an eloquent solution for implementing various filter-like services in a Slim app, such as authentication and caching. In this article I'll explain how middleware works and share with you a simple cache example that highlights how you can implement your own custom middleware.

He talks about what "middleware" is (complete with illustration) and how Slim can be used as a layer in the middleware stack. His example is a caching layer, based on Slim, that takes a request, checks the cache for it and returns it if it exists. If not, it saves the content to a database. He also includes code examples of how to use the "add" method to introduce your middleware libraries into the Slim application.

If you'd like more examples, the Slim project has several middleware examples provided in their "extras" github repository.

0 comments voice your opinion now!
slim middleware tutorial cache layer microsframework


blog comments powered by Disqus

Similar Posts

The Bakery - Rails-Like Validation, Elistic, Textile, and a CakePHP Release

Lullabot.com: Single Sign-on across Sub-Domains in Drupal with No Extra Modules

DevShed: Defining the Core Structure of a PHP Blogger

Bill's IIS Blog: PHP on IIS7 w/FastCGI

The Bakery: Nine New Tutorials, Helpers and Plugins for CakePHP


Community Events

Don't see your event here?
Let us know!


symfony2 install configure php7 release community interview framework laravel language performance example opinion application library podcast api introduction series conference

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework