 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
NetTuts.com: Taming Slim 2.0
by Chris Cornutt April 02, 2013 @ 09:17:11
On NetTuts.com today there's a new tutorial posted about "taming" Slim 2.0, the latest version of the popular PHP microframework. They look at application structure and share some tips to using this update.
Slim is a lightweight framework that packs a lot of punch for its tiny footprint. It has an incredible routing system, and offers a solid base to work from without getting in your way. Let me show you! But that's not to say that Slim doesn't has some issues; it's one-file setup becomes cluttered as your application grows. In this article, we'll review how to structure a Slim application to not only sustain, but improve its functionality and keep things neat and systematic.
He starts with an example of "vanilla Slim" and looks some at what's happening behind the scenes in the routing engine. They then give you a step by step installation and usage guide including updating the router to use class files. An example controller is included as well as some basic error handling using a Twig template for use across the application.
voice your opinion now!
slim microframework tutorial introduction class controller router error handling
PHPMaster.com: Working with Slim Middleware
by Chris Cornutt 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.
voice your opinion now!
slim middleware tutorial cache layer microsframework
IBM developerWorks: Create REST applications with the Slim micro-framework
by Chris Cornutt December 17, 2012 @ 12:56:24
On the IBM developerWorks site there's a new tutorial posted walking you through the process of creating a REST application with Slim, a popular microframework for PHP.
In this article, I introduce you to Slim, a PHP micro-framework that's designed for rapid development of web applications and APIs. Don't be fooled by the name: Slim comes with a sophisticated URL router and support for page templates, flash messages, encrypted cookies, and middleware. It's also extremely easy to understand and use, and it comes with great documentation and an enthusiastic developer community.
They start off by defining REST in terms of its usual four "verbs" - GET, POST, PUT and DELETE - and the conventions of the types of actions for each. Once you get the framework installed (via Composer) they help you create a sample database with an "articles" table and some sample data your service will work with. They go through each of the "verbs" and include code showing how to respond to the requests for each, including some exceptions for when things go wrong. There's also a bit about adding authentication "middleware" to the process - a hook to validate a user key as a part of the routing process. They finish things off by showing how to support multiple response formats and like XML and JSON based on the requested media type.
voice your opinion now!
slim microframework tutorial rest api interface
PHPMaster.com: Writing a RESTful Web Service with Slim
by Chris Cornutt July 27, 2012 @ 10:53:30
On PHPMaster.com today there's a new tutorial showing you how to create a simple RESTful API with the help of the Slim PHP microframework.
Through a series of articles here at PHPMaster you've learned about what is REST and how it works. In this article, I'd like to show you how to create a RESTful web service using Slim, a PHP micro-framework inspired by Sinatra, a Ruby framework. It's well-suited for creating simple RESTful web services and comes with some minimal components like Router, Request, Response, and View. It's very simple, and is easy to understand and use.
He walks you through the basics of getting the framework downloaded and set up as well as showing you how to make some basic routes ("Hello World" style). He then uses the NotORM library to work with his database and, via a RESTful interface, give information about books, edit their information and add new ones.
voice your opinion now!
rest api slim microframework webservice tutorial
NetTuts.com: Creating a Flat-File Blog Engine Using Slim
by Chris Cornutt June 19, 2012 @ 08:48:15
On the NetTus.com site today there's a new tutorial showing how to use the Slim microframework to create a flat-file blog system as a stand alone PHP application.
In this article, we will learn how to create a flat file blog engine in PHP using the Slim framework. If you don't understand the jargon, don't worry. We're simply going to create a spartan blogging application, which utilizes text files instead of a database to store data. If you're a beginner, fret not! We will start with the basics of using Slim.
He introduces the Slim framework with a simple route handling to render a basic PHP page (an "About" page), setting variables to output to the template, setting up dynamic routes and creating the setup for the blogging engine (viewing articles, archives and a listing page).
voice your opinion now!
flatfile blog slim microframework tutorial introduction
Chris Hartjes' Blog: Simple API Testing Using Behat
by Chris Cornutt February 27, 2012 @ 10:09:18
Chris Hartjes has taken some of his first steps to testing a web service with the help of the Behat BDD testing framework. In this new post he shares some of that knowledge and a bit of code to help guide you if you'd like to get started yourself.
I have been trying to push my JavaScript skills lately by first playing around with Node.js to get a feel for event-driven server-side coding and by trying to build something semi-useful using Knockout. [...] After working with PHPUnit's "assert that the result matches expectations" philosophy, switching to using a behavioural approach has changed how I decide to approach actually testing something.
He shows how to define a "scenario" in a more recognizable sort of English. His example is testing a web service to ensure of a few things:
- the response is JSON
- it contains at least one transaction
- the first transaction has an ID, contains two teams and has a description
Included in the post is the resulting Behat test code (generated and modified with his testing details) and an example of the execution of the test.
I think that the BDD approach maps better to a results-oriented methodology when it comes to testing: you are using real-life scenarios to make sure that you are getting back the results you are expecting. In the end. that is still the goal of testing.
voice your opinion now!
simple api test behaviordriven behat example slim framework
Chris Hartjes' Blog: Organzing Slim Framework Applications
by Chris Cornutt February 15, 2012 @ 08:57:28
One of the more popular PHP microframeworks right now is Slim and Chris Hartjes has a new post to his blog about a good way he's found for organizing applications that use this handy tool.
I've never really used a microframework in PHP before. I used Flask for a Python project that I did to experiment with using Google App Engine. The principles seem to be quite similar (although I will admit that having decorators in PHP would be ineresting) but the trade-off with a microframework is that you usually have to figure out an application layout for yourself.
He also uses the Pimple dependency injection container, Twig templating and Composer for package management. He describes how he got it all set up - organizing the code so Composer could understand it, creating the Twig templates directory and creating some of his default routes.
voice your opinion now!
slim application organization composer pimple twig
ZendCasts.com: Building a JSON End-Point With SLIM and jQuery Part 2
by Chris Cornutt November 09, 2011 @ 10:04:00
On ZendCasts.com today there's a new screencast in their "Building a JSON endpoint with the Slim microframework" series - part two focusing on jQuery integration. (Part one is here)
[This screencast is] part 2 in a series on building a JSON end-point. We're using simple RESTful verbage to grab a list of names from a session store.
You'll need to have the base scripts created in part one to follow along effectively. He picks up right where the previous part ends, creating a new view that uses some simple javascript (jQuery) code to pull the "names" values from his simple JSON endpoint. Also included is an example of a form for adding a new name to the list. The full source for the example can be found over on github.
voice your opinion now!
json endpoint tutorial screencasts slim microframework
|
Community Events
Don't see your event here? Let us know!
|