background preloader

Create a REST API with PHP « Gen X Design

Create a REST API with PHP « Gen X Design
Your apps never had it so good One of the latest (sort of) crazes sweeping the net is APIs, more specifically those that leverage REST. It’s really no surprise either, as consuming REST APIs is so incredibly easy… in any language. It’s also incredibly easy to create them as you essentially use nothing more than an HTTP spec that has existed for ages. Seriously, if you’ve never used REST, but you’ve ever had to work with (or worse, create) a SOAP API, or simply opened a WSDL and had your head explode, boy do I have good news for you! So, What on Earth is REST? Before we get into writing some code, I want to make sure everyone’s got a good understanding of what REST is and how its great for APIs. Requests All APIs need to accept requests. The other piece of a request is what it’s actually meant to do, such as load, save, etc. Responses So, REST handles requests very easily, but it also makes generating responses easy. Getting Started with REST and PHP So, let’s dig in! Sending the Response

65 Beautiful Fonts You Can Download For Free - StumbleUpon - Pentadactyl Freebie 65 Beautiful Fonts You Can Download For Free by Alex on Aug 9, 2012 • 9:43 am 17 Comments There are so many free fonts all around the web these days and sometimes it makes me think is their any really point purchasing fonts. I’ve decide to collect 65 fonts which are suitable for web, print, etc just overall high fonts which can be used in design projects. If you like fonts, you’ll love our favorite premium font, check it out here on Envato Market. Neuton Font Family Download Font → Intro free font Download Font → Bemio Download Font → Exo Font Family Download Font → Rex Free Font Download Font → Metropolis 1920 Download Font → Free Typeface NeoDeco Download Font → Hagin Free Font Download Font → Mosaic Leaf Download Font → Cubano Download Font → Cubic Sans Download Font → Banana Brick Download Font → Sofia Download Font → Sansita One Download Font → Villa Didot Download Font → Accent Download Font → Lavanderia Download Font → Blanch Download Font → Lorena Download Font → Age Download Font → Arvo Download Font → Banda Code

Social Network Style Posting with PHP, MongoDB and jQuery - part 1 Post mechanisms similar to Facebook are nowadays very common within any application. The concept of Post-Like-Comment is familiar to everyone who ever used a social network. In this article, we will learn how to create a similar working model wherein the user will be able to post his status, like posts and comment on them. What’s more interesting is that after learning things from this article, going forward you will be able to implement a lot of other features on your own. I’ll be using PHP as the coding language, MongoDB as the database and jQuery for JavaScript operations. There are two articles in this series. Before getting started, let us look at the final work we will develop (Fig 1 ). Download Code: Download the code provided with the article from its Github repo. index.php : This is the main file which displays all the posts and from where the user will interact. mongo_connection.php : This file contains the common MongoDB connection code. Database Structure: Conclusion:

How to Add an API to your Web Service Introduction APIs are a great way to extend your application, build a community, excite your users and get in on the Mashup Mania spreading across the web. While there’s plenty out there wanting in on the action, there’s a lot of questions about how to actually go about creating an API for a web application. Like everything else technical on the web these days, there are tons of complicated and scary documents out there ready to intimidate the unprepared. In an attempt to get everyone on the bus in one piece, we’ve tried to filter through the hard stuff and give an easy to understand starting point for anyone on a quest to API’ify their web service. An API, or Application Programming Interface, is a set of functions that one computer program makes available to other programs (or developers) so they can talk to it directly without having to give it access to the source code. The Basics There are two types of heavily used APIs for web services: SOAP and REST. Making The Request Holy Grail

40+ Excellent Freefonts For Professional Design - StumbleUpon - Pentadactyl Plugin de commentaire Dans ce tutoriel je vous propose de découvrir comment créer un système de commentaire modulable et réutilisable (une sorte de plugin). A la fin de ce tutoriel on aura une class Comments que l'on pourra utiliser (et réutiliser) dans nos différents projets. Objectif Avant de se lancer dans le code il faut réfléchir à ce que l'on cherche obtenir : Se créer un "plugin" que l'on va pouvoir utiliser Avoir qqchose qui s'adapte à la pluspart des casOn ne s'occupera pas du code HTML (varie entre chaque projet)Doit être indépendant de la structure du code On va donc utiliser la programmation orientée objet en se créant une classe qui va contenir nos différentes fonctions. <? Cette super classe va devoir intéragir avec notre base de donnée donc il va nous falloir utiliser une connexion (on choisira pdo ici). ... class Comments{ private $pdo; public function __construct($pdo){ $this->pdo = $pdo; } } Récupération des commentaires Sauvegarde des commentaires Et voila ! Simple non ? Fonction répondre

Short List of RESTful API Frameworks for PHP Having a web API is an essential part of doing business online today. We wanted to help get you started. So we took some time to pull together a list of the RESTful or RESTish (however you choose to view it) API frameworks, that can help you deploy your API faster. Today we are going to take a look at seven RESTful API frameworks for PHP: Dave - DAVE is a minimalist, multi-node, transactional API framework written in PHP. which contains an end-to-end API test suite for TDD, a Task model, an Active Database Model, and a stand-alone development server to get you started. Epiphany – A micro PHP framework that’s fast, easy, clean and RESTful. FRAPI - FRAPI is a high-level API framework that powers web apps, mobiles services and legacy systems, enabling a focus on business logic and not the presentation layer. Recess - Recess is a RESTful PHP framework that can be used by both beginner and seasoned developers. Zend Framework – Zend_Rest_Server is intended as a fully-featured REST server.

Foundation: HTML Templates - StumbleUpon - Pentadactyl News or Magazine This template puts a focus on bold images, perfect for a magazine style site with eye catching content. Your stories are easy to find with large feature blocks. See Demo Real Estate or Travel Big thumbnails with a space for captions and descriptions along with an informative header make this the perfect template for real estate or hotel booking. See Demo Ecommerce Homepage Building an online store? See Demo Agency Bring your work to the forefront with this sleek template that's perfect for agencies or freelancers. See Demo Blog w/ Sidebar Large images, an easy to navigate layout, and versatile sidebar will help you get your blog up and running. See Demo Blog Single Column This sleek, minimal approach can help your blog stand out by putting content front and center. See Demo Portfolio Show off your work and highlight what you do with this grid style thumbnail layout. See Demo Product Page Highlight your new product and educate potential customers with this classic template. See Demo

Sorting a Multi-Dimensional Array with PHP | firsttube.com Every so often I find myself with a multidimensional array that I want to sort by a value in a sub-array. I have an array that might look like this: //an array of some songs I like $songs = array( '1' => array('artist'=>'The Smashing Pumpkins', 'songname'=>'Soma'), '2' => array('artist'=>'The Decemberists', 'songname'=>'The Island'), '3' => array('artist'=>'Fleetwood Mac', 'songname' =>'Second-hand News') ); The problem is thus: I’d like to echo out the songs I like in the format “Songname (Artist),” and I’d like to do it alphabetically by artist. So I developed a quick function to sort by the value of a key in a sub-array. function subval_sort($a,$subkey) { foreach($a as $k=>$v) { $b[$k] = strtolower($v[$subkey]); } asort($b); foreach($b as $key=>$val) { $c[] = $a[$key]; } return $c; } To use it on the above, I would simply type: $songs = subval_sort($songs,'artist'); print_r($songs); This is what you should expect see: The songs, sorted by artist.

BRob On Tech » Blog Archive » Open Source Testing Tool Smackdown for REST Web Services Recently I’ve been working on a REST API for reporting workflow status information in Alfresco. After getting some of the functionality nailed down, it really bothered me that I wasn’t able to use Test Driven Development (TDD) in the process. So I went looking, and I found quite a few open source tools out there in the wild that made good prospects for acceptance testing these REST APIs that I was working on. It was time for a SMACKDOWN! OOOOOOOH YEAAAAAAAH! Contender #1 – Selenium I heard of Selenium in the past and have wanted to tinker with it for a long time, so I tried this one out first. That was very cool, but I needed to test result sets with dynamic data, so I had to take a look at Selenium-RC, which has APIs that enable the use of your favorite programming language: Java, C#, Perl, PHP, Python, or Ruby. Oh, one other note. Contender #2 – HTMLUnit This is basically just a Java API that makes it easy to extract information from web pages programatically. Contender #3 – JWebTest

"Buddycons" - Vector Social Media Icons - StumbleUpon - Pentadactyl Today we’re giving away a wonderful set of social media icons designed exclusively for WDD by Orman Clark, a web designer from the UK. The icon set is called “Buddycons” and includes 126 vector social media icons. Included in the set are PNG versions of all 126 icons in both circular and rounded variations as well as a vector source file for easy resizing. The icons are free to use for personal and commercial usage, however, redistribution is not allowed, so if you’d like to share these icons with your friends, please direct them to this page so that they can download their own copy from here. See a full preview of the icons and the download link after the jump. Orman Clark is a web designer based in the UK. Download more free vectors at 1001FreeDownloads.com Please enter your email address below and click the download button. Please enter your email address below and click the download button. WDD staff are proud to be able to bring you this daily blog about web design and development.

WordPress Serialized PHP Search Replace Tool | Interconnect IT - WordPress Consultants, Web Development and Web Design Search Replace DB version 3.0.0 (currently a BETA version) allows you to carry out database wide search/replace actions that don’t damage PHP serialized strings or objects with a user friendly interface and experience. Installation & Use Now acts like a web app! To use the script, download the zip file from below, extract the folder called secret-name-please, renaming it to something secret of your choosing, then navigate to that folder in your browser. To see how you can use this tool to aid migrations, check out our article on WordPress migrations or visit the WP Tuts+ article that mentions this script. If you are in any doubt whatsoever about how to use this standalone script, then please consider getting an expert in. IMPORTANT: This code is supplied with no warranty or support implied. Download v 3.0.0 BETA Problems? Changelog: To Be Done Ensure UTF8 encoding is enforced (see comments). Contributions Donations We’ve been asked a lot in the comments box below about accepting donations.

Creating a PHP REST API Using the Zend Framework « Chris Danielson's Blog I don’t know about you, but I spent hours pouring over the Zend documentation and searching the Internet for some sort of understanding or example regarding how to do REST the correct way in PHP. I found a handful of one-offs, where everyone was writing their own core REST engine from scratch. I figure why write all the code to handle this, if you already have the Zend Framework in your code base. I believe that the ideal solution will effectively use the the Zend_Rest_Controller and ContextSwitch objects as well as offering JSON and XML formatting options. My goal here is simple. I want to give you the building blocks to aid in writing an easily maintainable REST API in PHP using the Zend Framework. This code example will support REST data in the format of XML and JSON . Prerequisites: PHP version > 5 Zend Framework 1.9.2 (at the minimum) The generic download page can found here . Download ZendRestExample Source . Basic Directory Structure: URLS used in this example:

Font Generator - Make Your Own Handwriting Font With Your Fonts - Pentadactyl

Related: