News Feed
Jobs Feed
Sections




News Archive
feed this:

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/

Lee Davis:
Is a HTTP DELETE request idempotent?
November 01, 2013 @ 09:15:18

Lee Davis has a new post to his site with some thoughts about RESTful APIS and the correct response to DELETE calls when a resource has already been removed. One camp says a 404 should be thrown as it's no longer there, the other says 204 a "No Content" should always be returned. Lee looks at both sides of the argument and shares some of his own thoughts too.

Recently I had a read of an interesting post by Lukas Smith (@lsmith) about the use of the DELETE method when building RESTful services. I wanted to get my thoughts down on this. Mostly to help myself, but if it helps you determine a better approach, then great. I'm nowhere near qualified enough to preach, so this is by no means a "you should do it this way / my way is correct post", just food for thought. Besides, there are probably more questions here than answers.

He talks about the idea of "idempotence" when it comes to REST APIs and how it relates back to the DELETE discussion. He points out that the term has more to do with the end result of the request and not so much about how it's handled (and any "side effects" that may come with it). Various checks on the resource in question - like "does it exist" - could be considered a side effect of its operation. In his opinion, though, the 200 series of responses are more appropriate when a resource is actually deleted.

0 comments voice your opinion now!
delete rest api idempotent opinion resource

Link: http://www.duckheads.co.uk/is-a-http-delete-requests-idempotent/491

PHPMaster.com:
Exploring PHP's IMAP Library, Part 2
October 04, 2012 @ 10:36:22

PHPMaster.com has published the second part of their series taking you on a tour through PHP's IMAP extension and its use. In part one they introduced the extension and showed how to connect, get the folders/emails and view message contents. In this part they expand n that and show you how to work with the messages and attachments.

In the first part of this series I discussed how to connect to IMAP servers using PHP's IMAP extension. In this part we'll complete the series by discussing working with folders and reading email content. Let's get started!

He shows how to work with the "flags" set on messages (read, unread, replied, etc) - pulling them from the server and using the imap_setflag_full function to set them. There's a quick mention of deleting messages with imap_delete/imap_expunge and a section on viewing and downloading the attachments to messages.

0 comments voice your opinion now!
imap library extension tutorial series attachment flags delete


ZendCasts.com:
RESTful Delete with SLIM, jQuery and JSON
December 13, 2011 @ 09:56:34

Continuing on with his webcast series looking at using the Slim microframework to create a RESTful web service with JSON Output, John Lebensold takes the code from the previous tutorials (part one, two, three) and adds handling for DELETE to remove values from the data.

This tutorial will show you how to add jQuery RESTful calls for using the DELETE verb when deleting items via a JSON REST interface.

You'll definitely need to check out either the previous tutorials in the series to follow along with the code or grab the current source to see how everything's structured.

0 comments voice your opinion now!
rest webservice jquery frontend delete verb tutorial webcast


SpeckBoy.com:
Getting Started with CRUD In PHP
February 18, 2011 @ 12:10:10

On SpeckBoy.com there's a new tutorial posted that introduces you to the concept of CRUD - Create, Read, Update, Delete - in the database interface for your application. Technically CRUD can be applied to any sort of data store, but they chose to go with a MySQL-based example.

It has become a common necessity for website owners to collect data and manage it properly. Creating a MySQL CRUD class allows you to conveniently create, read, update and delete entries for any of your projects, indifferent of how the database is devised. CRUD allows us to generate pages to list and edit database records. So, in this tutorial I will show you how to build a simple CRUD web app, that will empower you with the basic functions of database management.

They briefly walk you through the setup of a XAMPP server to use as a base and give you the settings needed to create a simple users table. The rest of the post is the code you'll need to make the connection from your PHP script, insert data into the table, update them, remove the rows and display their contents. They've wrapped it all up in a single "index.php" file to make it simpler.

0 comments voice your opinion now!
crud database mysql tutorial create read update delete


Jani Hartikainen's Blog:
How to create Doctrine 1-style Soft-Delete in Doctrine 2
December 06, 2010 @ 13:02:08

Jani Hartikainen has posted his technique for making the Doctrine version 1 style "soft delete" in your Doctrine 2 powered application.

Doctrine 1 has the concept of behaviors which you could add to your models. One of these was the soft-delete behavior, which allowed you to "delete" records without really deleting them. Doctrine 2 does not have behaviors due to various reasons. However, I needed a way to have a model which worked like soft-delete. Let's see one approach to creating such behavior in Doctrine 2.

He introduces the idea of a "soft delete" - essentially a flag that gets set to let the rest of the application think that row is essentially deleted. He shows you how to create the similar functionality via a repository that filters the data for you. He includes code to help you along, defining the find/findOneBy/findBy and the example repository that lets you set an "is deleted" property on the object.

0 comments voice your opinion now!
doctrine soft delete repository filter


Zend Developer Zone:
Deleting indexes from Zend_Registry and why you shouldn't do it !
October 15, 2010 @ 09:19:47

New on the Zend Developer Zone today there's a post that looks at working with the Zend_Registry component of the Zend Framework and how deleting the index out of it directly could be a bad thing for your application.

Zend_Registry is the implementation of the Registry design pattern in the Zend Framework. It is similar to the $_GLOBALS array in pure PHP , but unlike it, it does not provide a transparent way to unset values at a specified index. As you will see in this short article, there is a very simple way to do it, but that doesn't mean it should be done.

He advises against directly using the "_unsetInstance" method that the component provides to remove items from the registry but that could cause unwanted side effects with your data. Instead he recommends using the SPL ArrayObject interfaces and the "offsetUnset" method on the registry instance to drop the item. He ends with a word of warning, though - be careful what you remove in one part of your application because something, somewhere might be depending on it being there, set or not, to make another decision.

0 comments voice your opinion now!
zendregistry zendframework delete index opinion


Richard Thomas' Blog:
Solar Framework Shorts - Deleting Caches
September 28, 2009 @ 11:11:57

Richard Thomas has posted a new "short" for users of the Solar Framework to delete cached data.

This one is simple but sweet, In your Models directory you define your Models and the basic rules they follow but do you know you can also make changes at the record level. Solar is smart and if it sees a Test/Record.php when creating records for the Test model it will load that class, this allows you to do all kinds of magic.

His example shows how the script can automatically check, on pre-save, to see if the data is different than that in the cache and remove it if so. This cached data is replaced the next time through with the latest information.

0 comments voice your opinion now!
solar framework short delete cache automatic


Ian Selby's Blog:
Making RESTful Requests in PHP
May 15, 2009 @ 07:57:19

In a new post to his blog Ian Selby looks at working with REST requests in PHP. He includes some of the basics of REST too, for those not completely familiar with the term.

APIs have become a very commonplace part of many popular web sites and services...especially REST APIs. I've already discussed how you can roll your own REST API for your PHP apps, but I've also received countless requests to go over how to actually make RESTful requests. That's exactly what we'll take a look at in this article

His tool of choice is the curl extension, making it simple to create a class wrapper with methods like executePost, executeGet, setAuth and, of course, execute. He outlines the class and gives the code blocks that fit inside each of the major functions. In the end you'll have a class that can make GET, POST, PUT and DELETE requests and be able to correctly parse the response.

0 comments voice your opinion now!
delete post put get tutorial request rest


DevShed:
Updating and Deleting Database Records with the Active Record Pattern
March 12, 2009 @ 09:35:02

DevShed has posted the next article in their Active Record series. This time it's a look at updating and deleting records from the database (the previous article was about selecting and inserting).

This pattern permits you to achieve a high level of abstraction when performing typical operations, such as insertions, updates and deletions of records, since all of these tasks are handled transparently by data mappers objects or a data access class. [...] Now, it's time to learn how to use the active record pattern for performing database updates and deletions in a few simple steps.

After reviewing the previous article, they add some new features onto the MySQL access class to let you update and remove data through a similar interface.

0 comments voice your opinion now!
update delete tutorial activerecord designpattern database mysql



Community Events











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


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

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