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

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/

Hannes Magnusson:
I have a dream
May 26, 2014 @ 09:23:54

In his latest post Hannes Magnusson describes his "dream" about a future for PHP where things like upgrading and working with extensions would be simpler, faster and more manageable.

Today we will revolutionize PHP. We will make it easier to upgrade the things you care about. We will make it easier to not upgrade things you don't want to upgrade. We will make it easier to distribute your extensions. We will make it easier to release according to your own schedule. We will make it easier to add functionality. We will make it easier to work. Ok, today is a white lie here maybe... I haven't actually implemented this, but bare with me here for a second.

With the introduction and huge growth of Composer, the PEAR package manager is fading in popularity and is slowly being abandoned. Unfortunately, it's still the primary mechanism for deploying and installing PHP extensions (PECL packages). He talks about some of his recent experience reviving a package and issues he had around the use of the packaging manager. He proposes the creation of a new "pecl install" tool - a package manager dedicated to PHP extensions, decoupled from PEAR.

The manager would just install basic PHP then leave it up to you to pick which features you need from there. The idea is still in its early stages, but the idea has taken roots and plans are being worked through to see if this idea will work for the future of the language.

0 comments voice your opinion now!
pear pecl future language package manager extension

Link: http://bjori.blogspot.com/2014/05/i-have-dream.html

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

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/

PHP Town Hall:
Episode 20 A Nice Friendly Chat About Sculpin, Guzzle and PSR-7
March 07, 2014 @ 09:03:51

The PHP Town Hall podcast has released their latest episode today, Episode 20: A Nice Friendly Chat About Sculpin, Guzzle and PSR-7 with guests Beau Simensen and Michael Dowling.

This show has a history of talking about FIG stuff as it is hard to avoid. The group is working on so much cool stuff and prominent figures of the community are involved. We got two more prominent figures, who also happen to be involved with FIG stuff: Beau Simensen lead developer of Sculpin and Michael Dowling lead developer of the wonderful HTTP library Guzzle, who also works at AWS on their PHP SDK.

They talk about each of the projects mentioned and what's coming up for each. There's also some discussion around the PSR-7 HTTP spec that's been proposed and is in the works. You can listen to this latest show in a few different ways - either through the in-page audio player, by downloading the mp3 or you can watch the video of the live recording via Google Hangouts.

0 comments voice your opinion now!
phptownhall ep20 podcast beausimensen michaeldowling psr7 http

Link: http://phptownhall.com/blog/2014/03/06/episode-20-a-nice-friendly-chat-about-sculpin-guzzle-and-psr-7/

PHPClasses.org:
Using Composer to Install JavaScript, CSS & Images Under the Web Document Directory
January 07, 2014 @ 12:36:07

On the PHPClasses.org site today there's a new post showing how to install more than just PHP packages with Composer including things like Javascript, CSS and image files.

By default Composer installs all package files under the vendor directory. If you want to install asset files in the Web document root directory, you need to resort to another solution. This Asset Manager package is a plugin that extends Composer to install any package files outside the vendor directory. Additionally, it can also read the user names and passwords from a configuration file, so you do not have to enter them every time Composer retrieves packages from repositories that may require authentication, like PHP Classes and JS Classes.

Using an asset manager plugin for Composer, he shows how to include an "extra" section into your "composer.json" for the other files. There's also an example of how to implement a custom installation action that, in this case, was used to implement the "extras" functionality. The post finishes up with a look at handling authentication in the Composer requests, using the same tool to parse a "config" section with Basic HTTP authentication information.

0 comments voice your opinion now!
composer package install javascript css image assets http authentication

Link: http://www.phpclasses.org/blog/package/8429/post/1-Using-Composer-to-Install-JavaScript-CSS-and-Images-Under-the-Web-Document-Directory.html


Community Events





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


testing install language introduction configure opinion community developer release series list unittest refactor laravel interview code wordpress framework podcast threedevsandamaybe

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