News Feed
Sections




News Archive
feed this:

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

Michael Dowling:
Guzzle 5 and RingPHP
October 14, 2014 @ 10:52:25

Michael Dowling has a new post to his site today talking about the latest release for the Guzzle HTTP library and how it now works with RingPHP to make integration life easier. The RingPHP library, inspired by Clojure's Ring library, provides a low-level structure to work with HTTP clients and servers through a simple interface.

With RingPHP, Guzzle does not require cURL and can be used with any HTTP transport mechanism. I'd love to help anyone who is interested in creating RingPHP adapters to bind Guzzle to another library. For example, WyriHaximus on Github is working on binding Guzzle to ReactPHP. (In fact, Guzzle 4 did not require cURL, though it was much harder to use an alternate transport.)

He goes on to talk more about the changes in the Guzzle 5 release including more detail on the RingPHP integration, the use of promises/futures and iterable and callable streams. There's also several new events included in the release as well. He finishes out the post with an upgrade guide to help make the transition easier.

0 comments voice your opinion now!
ringphp guzzle5 release http promise future psr7 streams events

Link: http://mtdowling.com/blog/2014/10/13/guzzle-5/

Michael Dowling:
Guzzle-Ring and Future Responses
September 30, 2014 @ 09:36:32

Michael Dowling has a new post to his site today talking about the work that's being done on the upcoming release of the Guzzle HTTP client. In the post he talks about a major change in how it allows for asynchronous requests and the work on Guzzle-Ring to make it happen.

Guzzle 4 has been out for a little over six months. It has proven to be leaps and bounds better than Guzzle 3, and I've been very happy with the design so far. However, after the release of Guzzle 4, I've received feedback from numerous members of the PHP community that can be boiled down to "Guzzle needs async support." While Guzzle has always had the ability to send requests concurrently using a pool of requests, there was not a way to send asynchronous requests.

After a couple months of work and borrowing concepts from Clojure, I've created Guzzle-Ring, an extremely simple adapter and middleware library for PHP (not just Guzzle) that can power both clients and servers for both synchronous and asynchronous requests.

The Guzzle-Ring reduces the need for the previous complexity of creating multiple adapters, which ended up with the adapters knowing too much about the request itself. He introduces the Guzzle-Ring system that will be included in Guzzle v5, heavily influenced by Clojure. The adapter makes the request as simple as passing in an array and makes use of "futures" to handle the request/response cycle. He also talks some about creating middleware piece that helps integrate it into your application, wrapping functionality inside of another method. He illustrates all of this with code examples and includes others such as fetching of future responses, sending requests concurrently and the Guzzle-Ring server adapters.

0 comments voice your opinion now!
guzzle guzzlering http client asynchronous request futures guzzle5 clojure

Link: http://mtdowling.com/blog/2014/09/28/guzzle-ring/

SitePoint PHP Blog:
Using Guzzle with Twitter via Oauth
July 31, 2014 @ 10:54:01

Continuing on with his series about using the Guzzle PHP HTTP library, Miguel Ibarra Romero is back with this new post showing how to connect your PHP application, via Guzzle, to the Twitter OAuth protected service.

In a previous article, we found out about Guzzle and how it can aid us in the task of establishing communication with third party APIs over HTTP. We used it to get the output of a random number generator and for basic interaction with Github's API. [...] While interacting with Github's API we discovered that it supports basic authentication (sending plain username/password). But what if the API we want to use just offers OAUTH authentication?

He shows how to use Guzzle's own OAuth subscriber to make a basic connection to the API. He walks you through the installation of the subscriber (via Composer) and an example of its use. He explains each part of the code, giving a little background on where it fits into the OAuth request and where to put your API secret and key to make the connection work. Finally, he includes the code to handle the callback once the OAuth request is successful, grabbing the token data and adding it to the user session.

0 comments voice your opinion now!
oauth twitter guzzle http library tutorial

Link: http://www.sitepoint.com/using-guzzle-twitter-via-oauth/

Michael Dowling:
A Case for Higher Level PHP Streams in PSR-7
July 15, 2014 @ 10:54:53

In his latest post Michael Dowling looks at a recently proposed PSR standard (the HTTP message one, created by him) and some of his thoughts around it and what it could do for the community.

There's been a lot of talk lately about the PSR HTTP message proposal, PSR-7. The purpose of the proposal is to create a shared interface that can be used by projects to interact with HTTP messages for both clients and servers. When I created the proposal, I envisioned the purpose is not to say projects that utilize HTTP messages need to make breaking changes to use the proposed interfaces, but rather give projects an interface for which they can create an adapter.

He points out that the major part of the proposal that's being debated is the message body methods and structure. He gives a quick overview of this API and how streams could fit in with it, providing a flexible abstraction layer over the actual data. He includes a few ideas for some functionality that could make streams work relatively easily with the proposal (using a StreamInterface):

  • No Auto-registering of stream protocols and filters
  • Exceptions cause warnings in stream wrappers and filters
  • Functionality is spread over many functions

He also shares an example (based around the Guzzle HTTP library) showing how this interface could be put to work. He also talks some about one of the major concerns voiced right now, getting the actual stream itself to work with, and shows how the "detach" method matches this goal.

0 comments voice your opinion now!
usecase streams highlevel psr7 proposal http

Link: http://mtdowling.com/blog/2014/07/03/a-case-for-higher-level-php-streams/

CodeSamplez.com:
PHP HTTP Request With Guzzle
June 12, 2014 @ 11:55:07

If you're making HTTP requests in your applications and you haven't looked into using Guzzle, you're missing out on one of the most powerful, flexible HTTP tools out there. In this new post to the CodeSamplez.com site they introduce you to the tool and show you how to make a few sample requests.

If you are consuming some kind of API with complex PHP HTTP requests which doesn't provide a clean wrapper library, I can feel the nightmare you might be having. Same could be happen if you are yourself writing such kind of API wrapper as well. Here, I will try to introduce you with guzzle library and getting a quick start. This article is targeted for complete beginners, so if you are already somewhat experienced, you either might skip this or review it and help me improve it to fit as a robust getting started tutorial.

He covers some of the things that can be done with Guzzle (including connecting to APIs and scraping site data) and briefly mentions some alternatives to the tool. Code is included to make a first request: a simple call to the GitHub API that fetches URL information for other resources. He also includes an example of making a POST request and using the OAuth module that comes with Guzzle, making those requests easier.

0 comments voice your opinion now!
http request guzzle introduction tutorial

Link: http://codesamplez.com/programming/php-http-request-guzzle

Evert Pot:
HTTP/1.1 just got a major update.
June 10, 2014 @ 11:23:57

While not specific to PHP, the HTTP specification that defines how web applications talk has gotten a major update in its latest version. In his latest post Evert Pot summarizes some of these changes and how they'll impact the work you're doing.

The IETF just published several new RFCs that update HTTP/1.1 [...] These documents make the original specification for HTTP/1.1 obsolete. As a HTTP geek, this is a big deal.

These new RFCs include definitions of standards around message syntax and routing, conditional requests, authentication, the 308 status code and the forwarded HTTP extension. Evert gets into the details of some of the changes, pointing out the major changes first and places where ambiguity has been resolved. He also includes a list of other "interesting things that have changed" in these new specs including clarifications around dealing with unexpected whitespace, the removal of the default charset of ISO-8859-1 and that the 204, 404, 405, 414 and 501 status codes are now cacheable.

0 comments voice your opinion now!
http11 http specification rfc update summary

Link: http://evertpot.com/http-11-updated/

SitePoint PHP Blog:
Unit Testing with GuzzlePHP
May 16, 2014 @ 11:56:46

The SitePoint PHP site has a new tutorial posted today showing how, if you're using the Guzzle PHP HTTP client, to work with it in your unit testing. He focuses on PHPUnit testing, but the concepts could be applied in other testing tools as well.

In this tutorial, I want to show you how to use Guzzle from a different perspective, specifically how to do unit testing with it. To do this, we're going to look at three specific approaches: hand crafting custom responses, using a ServiceClient with mock response files and enqueueing a Server with mock responses.

Matthew helps you get started by installing Guzzle and PHPUnit via Composer, including the "composer.json" contents you'll need. He shows you how to get PHPUnit all set up and how to create a first simple test that extends the "GuzzleTestCase" class. He then gets into the custom hand-crafted responses, showing how to push the contents of a text file into the client response. Next up he shows how to use the ServiceClient to create the same setup only simpler. Finally, he looks at the queue handling (via a small node.js background server) where the client passes requests and is returned the same mock body content. Code examples of both the requests and the PHPUnit tests are included through out the tutorial.

0 comments voice your opinion now!
unittest guzzlephp http client tutorial phpunit

Link: http://www.sitepoint.com/unit-testing-guzzlephp

Oracle Technology Network:
Installing PHP on Oracle HTTP Server 12c
April 25, 2014 @ 09:41:26

On the Oracle Technology Network site today they've posted an updated version of their guide to getting PHP installed on Oracle HTTP Server 12c, complete with all the commands you'll need to get the job done.

This article shows how to install PHP on Oracle HTTP Server 12c (OHS). PHP is a hugely popular, interpreted scripting language commonly used for web applications. OHS is the web server component for Oracle Fusion Middleware. It is based on the Apache HTTP Server. OHS includes a FastCGI module which can easily be configured to use PHP's bundled FastCGI Process Manager ("PHP-FPM"). PHP-FPM has become a standard way of installing PHP. I

The remainder of the post is broken down into the steps you'll need to get it all installed and working:

  • Install Oracle Linux
  • Install Oracle HTTP Server
  • Install Oracle Instant Client 12c
  • Install PHP
  • Configure PHP-FPM
  • Configure OHS
  • Start PHP-FPM & OHS

A simple test script (a phpinfo) is also included to help you ensure everything is running as it should be.

0 comments voice your opinion now!
oracle install http server 12c tutorial guide

Link: http://www.oracle.com/technetwork/articles/dsl/jones-php-ohs-2194096.html

InfoTuts.com:
Create Login With Google Plus in Your Website With PHP
April 15, 2014 @ 10:20:31

On the InfoTuts.com site they've posted a tutorial showing you how to make a "Log in with Google" button for your application and make it work with a little PHP magic on the backend.

So you want to allow users to login into your website using their gmail credentials? You have seen various websites that allow their users to login in their websites using gmail, facebook, linked in, Microsoft, git hub credentials. It's time to integrate it in your website. We will cover all the login system in our posts one by one and this one is dedicated to create Google Plus login for your website with PHP using OAuth2. Google offers many APIs like Google Maps, translate API, Analytics ApI etc. Today we will use its Google Plus API so lets proceed with our tutorial.

They break the process down into about five steps:

  • Login to Google API Console. Go to APIs and you will have to turn on Google Plus API.
  • Go to APIs and Auth and then under credentials tab. Click on create new client ID as shown below.
  • Now when you will have to enter your website path and the file path (redirect URI) to get your new client ID.
  • Now you have to set Consent screen.
  • In consent screen if you have entered Google Plus page path then you will have to approve connection.

The code for the actual connection is in the last step. It uses Google's PHP client libraries to configure and make the request, fetch the access token and grab the Google+ user's data.

0 comments voice your opinion now!
googleplus login oauth2 client library tutorial

Link: http://www.infotuts.com/login-with-google-plus-in-your-website-php

Michael Dowling:
Guzzle 4.0
March 31, 2014 @ 13:57:08

Michael Dowling has announced the release of Guzzle 4.0.0 on his site today. Guzzle is one of the most widely used, popular HTTP clients in the PHP community today. Its used in both corporate and open source projects as a primary means for making HTTP requests and RESTful web service clients.

Guzzle 4.0 has arrived! The new version of Guzzle is now simpler, faster, more flexible, and more powerful than ever. [...] Guzzle is a PHP HTTP client that makes it easy to work with HTTP/1.1 and takes the pain out of consuming web services.

He includes a quick example of it in use making a request to the GitHub API to fetch user information. He lists out some of the changes made in this release but points to this other post for the full list. He's also tagged other related projects to match this 4.0.0 release including Guzzle Streams and the Log Subscriber.

0 comments voice your opinion now!
guzzle http client restful release v4

Link: http://mtdowling.com/blog/2014/03/29/guzzle4/


Community Events





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


package voicesoftheelephpant community api series podcast opinion bugfix unittest deployment symfony framework interview language library zendserver release install laravel introduction

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