News Feed
Jobs Feed
Sections



Recent Jobs

News Archive
feed this:

Lorna Mitchell's Blog:
Building A RESTful PHP Server Routing the Request
January 23, 2012 @ 11:14:11

Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)

This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.

She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" methods for responding to GET and POST requests.

0 comments voice your opinion now!
restful server tutorial request routing controller get post action



PHPBuilder.com:
Building RESTful Web Services with the Zend Framework
November 11, 2011 @ 11:37:45

New on PHPBuilder.com today is a tutorial introducing you to web services with the Zend Framework, a guide to creating a simple RESTful service with this popular PHP framework.

Rather than attempt to build and maintain multiple versions of the Web application in order to accommodate the diverse array of challenges and advantages presented by each device type, developers are increasingly embracing a unified approach which allows them to manage a single server-side code base which communicates with multiple client-specific interfaces by way of a RESTful Web service. The Zend Framework's Zend_Rest component offers PHP developers with an incredibly straightforward approach to building RESTful Web services.

He shows how to set up some internal RESTful routing (with the help of Zend_Rest_Route) and create a simple controller that responds to several of the major HTTP request types - POST, GET, PUT, etc. In his simple example, he shows how to update a basic TODO list with a POST and the JSON response that would follow.

0 comments voice your opinion now!
restful webservice zendframework routing tutorial controller


ZendCasts.com:
SLIMming Out Your Controller
October 18, 2011 @ 11:02:58

On the ZendCasts.com site today, they branch out from just talking about Zend Framework-related topics and take a look at he Slim micro-framework in this new screencast.

He introduces the framework as a light-weight, easy to use tool that doesn't include "all of that extra stuff". He walks you through the creation of a (very) simple site that includes some basic templating too. At the end of the screencast he hints at the next part of the series - creating a simple JSON endpoint as a RESTful web service.

You can find out more about the Slim framework on its site that includes documentation and a PHPDoc generated manual for every part of the code.

0 comments voice your opinion now!
slim microframework screencast introduction template routing


Gonzalo Ayuso's Blog:
Building a small microframework with PHP
August 23, 2011 @ 09:48:27

In investigating microframeworks and some of the offerings out there Gonzalo Ayuso has done a little exploring of his own. He's worked up a basic microframework and shared it in a new post as a sort of academic exercise.

Nowadays microframewors are very popular. Since Blake Mizerany created Sinatra (Ruby), we have a lot of Sinatra clones in PHP world. Probably the most famous (and a really good one) is Silex. But we also have several ones, such as Limonade, GluePHP and Slim. Those frameworks are similar.

He looks at how several of these frameworks handle routing and setup, mostly using the closures/anonymous function callbacks available in PHP 5.3. His simple example framework does some basic URI handling to find the requested module, class and function (action) to call. You can even define the output format from options like json, txt, css, js and jsonp. A sample "controller" is included with a "Hello world" and there's a mention of some other options he's exploring including Twig and Assetic integration.

2 comments voice your opinion now!
microframework exercise routing callback anonymous function


Blitz Agency Blog:
REST Service Routing with PHP and Apache
November 19, 2010 @ 12:12:55

New on the Blitz Agency blog Adam Venturella walks you through his process of creating a simple REST service routing system with the PHP and Apache combination that has the same concepts as Sinatra routing.

This is just a quickie. I had spent some time creating a routing system in PHP for services. The goal was to bypass .htaccess or a vhost configuration file. Basically, I wanted to map endpoints (HTTP methods + paths) to PHP methods. My goal at the time was something similar to Sinatra and/or MVC2 routes.

He shows examples from both the Sinatra documentation and a code example from a MVC2 project that uses the same ideas. His first show with PHP proved to not quite be the right way, so he opted for a combination of Apache mod_rewrite and some PHP to take the mapped values and execute. It also includes support fo rthe "X-HTTP-Method-Override" header if you happen to need it.

0 comments voice your opinion now!
rest sinatra routing apache tutorial


Zend Developer Zone:
Zend Framework Routing with XML
May 14, 2010 @ 08:31:29

On the Zend Developer Zone today there's a new tutorial looking at creating custom routing with the help of XML for your Zend Framework application.

If you use Zend Framework you probably used the initRoutes() function in your Initializer.php to create nice URI's and creating some different routing in your application. To create a customized route for your application you can use the Zend_Controller_Router_Route class from the Zend Framework.

The tutorial shows you the code you'll need in your application, a sample XML document with some custom routes defined, the class to read it all in and the initializer to get the ball rolling.

0 comments voice your opinion now!
zendframework tutorial routing xml custom


The Bakery:
CakePHP's routing explained
November 02, 2009 @ 08:28:59

New on The Bakery there's an article explaining some of the inner workings of the CakePHP framework - its routing system.

Routing in CakePHP is a very powerful feature and is used to make URLs look good. Experience in the #cakephp IRC support channel tells me it appears to be hard to grasp even though the book is quite complete. This article should change that a bit and discuss the main features of routing. Comments below asking for support will be ignored, to get support, there is the Google group and the #cakephp IRC channel.

They look at some of the default routes built into the framework, how to create custom routes with named elements (and passing parameters into the action for them) as well as tips on setting up match conditions and prefix routing. Code samples are included.

0 comments voice your opinion now!
cakephp framework routing tutorial


Matt Curry's Blog:
8 Ways to Speed Up CakePHP Apps
March 18, 2009 @ 10:23:26

Matt Curry has a new post to his blog listing a few ways that you can help get the most out of your CakePHP application's performance.

It's a not so well kept secret that CakePHP is slow. What isn't well know is that this is done by design. I could get in a lot of trouble by revealing this, but I'm willing to take that risk. [...] Every time you use one of the tips in this article it's one less gold chain on the neck of a Cake developer.

Here's his list of eight tips:

  • Set Debug to 0
  • Cache your slow queries/web service requests/whatever
  • View Caching
  • HTML Caching
  • APC (or some other opcode cache)
  • Persistent Models
  • Store The Persistent Cache in APC
  • Speed Up Reverse Routing

Some of the tips are CakePHP specific, but several of them (the caching) can be useful no matter what sort of application you're using - framework or not.

0 comments voice your opinion now!
eight speed caekphp framework cache apc model debug reverse routing


Echolibre Blog:
Customising Zend Framework Routing
March 13, 2009 @ 10:23:04

On the echolibre blog J.D. has made a new post looking at Zend Framework routing and how you can customize it to get the user where they need to go.

I wanted to write a post that shows a few different ways to customise Zend Frameworks routing when you're using their MVC implementation. Most of this is covered in the documentation, but it can be a little difficult to dig out.

He starts with the normal routing setup (the standard /module/controller/action and /controller/action setups) and moves on to the "magic" - a way to have a standard "framework URL" without having to include an action. He sets up a route with a wildcard to catch anything for that controller and passes it off to a custom router that goes through the request values and returns the values as though they were formatted normally in the URL.

0 comments voice your opinion now!
zendframework routing custom wildcard match parameter url


Make Me Pulse:
Using the Zend Framework URL rewriting
January 15, 2009 @ 07:55:15

New from the Make Me Pulse blog is this quick tutorial about bending the URL rewriting that the Zend Framework does to match whatever your needs might be.

Today for a good website's referencement in Google, it's necessary to have an URL rewriting. [...] If your application is based on ZF, we have a htaccess base file which will redirect all php files to the boostrap (what is the bootstrap ?), and ZF classes will manage all redirection rules. How to implement the URL rewriting with ZF classes ?

He sets up a config file (an ini file) with the routing instructions the framework will need to adhere to and shows how to get the application to include it and match against it for routing rules. His example sets a default route and several regular expression-based routes to remap requests right where they need to go.

0 comments voice your opinion now!
zendframework config file ini routing regex default route tutorial



Community Events





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


community opinion custom framework component language symfony2 series database conference phpunit api test release unittest podcast development introduction application interview

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