News Feed
Jobs Feed
Sections




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

David Makin:
Creating a simple REST application with Silex part 2
January 24, 2014 @ 12:17:35

David Makin has posted the second part of his series looking at creating a simple REST API with the help of Silex. You can find part one here to get caught up.

In part 1 you installed Silex and setup 2 routes, / and /{stockcode}. Now lets expand upon those by adding a POST and a DELETE route. The 2 routes we created use GET but to make your application truly useful you will want to use at least 1 more type and that is POST.

He starts by adding a new POST route to handle the creation of a new "toy", complete with a correct response of a 200 code (HTTP for "created"). He follows this with a DELETE example, showing how to return a 204 if the delete works or a server error if something goes wrong. He also includes a curl call to test out the endpoints. In the upcoming third part David will look at breaking up the code a bit and putting it into separate files.

0 comments voice your opinion now!
silex rest application tutorial introduction delete created

Link: http://sleep-er.co.uk/blog/2014/Creating-a-simple-REST-application-with-Silex-part2/

blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Creating Web Page Templates with PHP and Twig (part 1)

Kevin Schroeder's Blog: Connecting to the Zend Developer Cloud using NetBeans for PHP

NETTUTS.com: Creating a Crypter Class with PHP

Sebastian Bergmann's Blog: Testing Your Privates

Padraic Brady's Blog: An Example Zend Framework Blog Application - Part 1: Introductory Planning


Community Events











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


package release hack framework symfony2 security overview component opinion language hhvm code install introduction podcast unittest support facebook application composer

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