background preloader

PHP

Facebook Twitter

Unirest – Lightweight HTTP Library For PHP, Ruby, Python, Java And Objective-C. Today, HTTP requests are used widely in websites as we fetch data using APIs, get screenshots or AJAX requests.

Unirest – Lightweight HTTP Library For PHP, Ruby, Python, Java And Objective-C

Unirest is a pack of lightweight HTTP libraries for many languages (PHP, Ruby, Python, Java And Objective-C). It has support for GET, POST, PUT, UPDATE, DELETE operations and its methods + response structure are the same in all languages. The usage is very simple and straightforward. Also, it is documented well. Social Auth For PHP Standalone Sites and Applications.

Social Auth Plugin is the authentication and authorization solution based on social networks for web applications.

Social Auth For PHP Standalone Sites and Applications

Nowaday, almost internet users have at least one account on social networks (like Facebook, Twitter or Google Plus …). Therefore allowing users log in your applications/sites (apps) via social network accounts is not only help your users approach your apps easily but also help you reduce amount of work which is not necessary to focus on developing your apps. So now I introduce you a simple way to make a Social Auth plugin for your apps. License: This product is free for both personal and commercial uses. Please note, resources (like: images, videos, audios ...) are used for demonstration purpose only. Registration and login base on social network sites.Get user data from social site (base on the social site’s support).Easy to deploy on several apps.Easy to store user data in your database (MySQL …).Social Network List: Facebook, Twitter, Google.

Change Logs: 26 Jul 2012: 1. Handling JSON like a boss in PHP. There are already lots of tutorials out there on handling JSON with PHP, but most of them don’t go much deeper than throwing an array against json_encode and hoping for the best.

Handling JSON like a boss in PHP

This article aims to be a solid introduction into JSON and how to handle it correctly in combination with PHP. Also, readers who don’t use PHP as their programming language can benefit from the first part that acts as a general overview on JSON. JSON (JavaScript Object Notation) is a data exchange format that is both lightweight and human-readable (like XML, but without the bunch of markup around your actual payload). Its syntax is a subset of the JavaScript language that was standardized in 1999. If you want to find out more, visit the official website. The cool thing about JSON is that you can handle it natively in JavaScript, so it acts as the perfect glue between server- and client-side application logic. Introducing JSON So, what datatypes does JSON support? Here’s a example JSON document: Back to JSON. PHP Fine Diff. This page demonstrate the FineDiff class (as in “fine granularity diff”) I wrote – starting from scratch – to generate a lossless (won't eat your line breaks), compact opcodes string listing the sequence of atomic actions (copy/delete/insert) necessary to transform one string into another (thereafter referred as the “From” and “To” string).

PHP Fine Diff

The “To” string can be rebuilt by running the opcodes string on the “From” string. The FineDiff class allows to specify the granularity, and up to character-level granularity is possible, in order to generate the smallest diff possible (at the potential cost of increased CPU cycles.) Typical usage: include 'finediff.php'; $opcodes = FineDiff::getDiffOpcodes($from_text, $to_text /* , default granularity is set to character */); // store opcodes for later use... Later, $to_text can be re-created from $from_text using $opcodes as follow: include 'finediff.php'; $to_text = FineDiff::renderToTextFromOpcodes($from_text, $opcodes); Diff stats: Notes.