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/

SitePoint PHP Blog:
Social Network Authentication Twitter and Facebook
July 21, 2014 @ 11:32:12

The SitePoint PHP blog continues their series of tutorials showing how to authentication your users against various social networks. In the previous post they covered connecting to Google+ and in this latest post they move on to two other popular social networks: Facebook and Twitter.

In the previous parts of this series, we created our initial interfaces, set up our Google+ login functionality and talked about how we can merge our accounts together. In this article, we will integrate Twitter and Facebook within our application. You will see a lot of similarities with the Google+ article, so if you could follow that one easily, you won't have much trouble with this one. If you haven't read that article yet, I suggest you read it first before continuing this article.

He starts off with the Twitter authentication, creating a new "SocialLogin" object type for it and defining the three required properties it needs to connect. Code is included to make the OAuth connection, pass along the callback URL and forward on the user to the Twitter site for approval. Code is also included to store the data about the Twitter user in your application. Next up is Facebook. The connection is very similar to the others with only a slight difference in the data that's required. You can find the full code for the tutorial so far in this Github repository.

0 comments voice your opinion now!
social network authentication tutorial series twitter facebook

Link: http://www.sitepoint.com/social-network-authentication-twitter-facebook/

SitePoint PHP Blog:
Paginating Real-Time Data with Cursor Based Pagination
July 11, 2014 @ 11:52:13

On the SitePoint PHP blog today a new tutorial has been posted introducing you to cursor-based pagination of real-time data, showing the results and allowing for easy click-through functionality.

Pagination is a technique for breaking large record sets into smaller portions called pages. As a developer, you should be familiar with implementing pagination, but implementing pagination for real time data can become tricky even for experienced developers. In this tutorial, we are going to discuss the practical use cases and solutions for real time data pagination and cursor based pagination.

He uses results from the Twitter and Facebook APIs in his examples, grabbing tweets matching the search term "php". He briefly explains some of the issues with real-time pagination and how it compares with standard pagination techniques. He uses the "after" and "before" functionality of each API to only pull the data needed, not the entire list of latest posts. This is added to a list in order and shown when the user view is refreshed. He includes the code for implementing the cursor-based handling and how to echo the results back out to a view.

0 comments voice your opinion now!
cursor pagination twitter facebook api tutorial realtime

Link: http://www.sitepoint.com/paginating-real-time-data-cursor-based-pagination/

Lorna Mitchell:
What Got You Involved in Open Source?
June 13, 2014 @ 12:16:04

Lorna Mitchell has shares some interesting results of a recent survey asking people how they got involved in working with open source projects. The results were from a poll announced on Twitter.

I did a very unscientific twtpoll recently regarding what brought each of us into open source. Plenty of people took the time to vote or retweet, so I thought I'd loop back around and let you know how it looked overall when the poll closed.

Not surprisingly, the largest group came from the "find a problem, submit a fix" category (40%) with the next in line being the group that open sourced their own code. The third category she mentions, coming in at 18% of the responses, was those seeking new skills either for personal growth or for their current (or next) job.

0 comments voice your opinion now!
opensource involvement poll twitter results developer

Link: http://www.lornajane.net/posts/2014/what-got-you-involved-in-open-source

New Relic Blog:
25 PHP Developers to Follow Online
May 14, 2014 @ 09:14:55

On the New Relic blog today there's a new list posted of the 25 PHP developers they suggest you follow, both on Twitter and via their code contributions.

Building PHP frameworks is hard, but following these PHP source and framework committers on Twitter is easy. You'll learn lots of interesting bits about what's happening in their respective communities, and if you want to see where the PHP and PHP framework communities are going next, just watch your feed for these folks.

Included in their list are PHP notables like:

Check out the full post for the rest of the list!

0 comments voice your opinion now!
developers follow opinion twitter github source framework community

Link: http://blog.newrelic.com/2014/05/02/25-php-developers-follow-online/

Rob Allen:
Use statements
March 17, 2014 @ 10:13:08

Rob Allen's latest post focuses in on something that's been a part of PHP for a while now, back when namespacing was introduced - the "use" keyword. He shares some thoughts, both from others and himself, about whether or not they make code more readable.

I was having a discussion on IRC about use statements and whether they improved code readability or not. [...] Those longer class names make it a little hard to quickly parse what it going on. The [example with "use" statements] is clearly less cluttered, but is at the expense of ambiguity. Exactly what class is User? I would have to go to the top of the file to find out. Should I use aliases? If so, how should I name them?

He went out to Twitter for advice from other PHP developers on the issue too. The feedback from his question came mostly in support of the "use" statements:

  • "I think use statements just abstract where the class is coming from. Some people find that useful."
  • "I think it's helpful seeing all of the packages used by a class without having to look through the full code."
  • "One reason I like them is that I can glance at a file and know dependencies immediately."
  • "I do appreciate what you are saying about the indirection use statements introduce."

There's also a bit of talk about "aliasing" with namespaces rather than the full classname, then using the namespace and class name in the code to "minimise ambiguity".

0 comments voice your opinion now!
use statement namespace twitter advice feedback alias

Link: http://akrabat.com/php/use-statements/

ReviewSignal Blog:
Long Running Processes in PHP
August 23, 2013 @ 11:29:03

On the ReviewSignal blog today there's a post looking at their use of long running PHP processes and how they got around some of the common problems.

Here at Review Signal, I use a lot of PHP code and one of the challenges is getting PHP to run for long periods of time. Here are two sample problems that I deal with at Review Signal that require PHP processes to run for long periods of time or indefinitely: data processing and Twitter streaming API data.

They talk some about their use of the PHP CLI, bash and cron to execute their scripts. There's a bit about the difference between executing a script in ssh versus cron and how to use "nohup" to have it execute in the background. They show how to set up a cron job and, more specifically, how their script pulls from the Twitter API via a bash script to check if it's already running.

0 comments voice your opinion now!
long running process example twitter api streaming

Link: http://reviewsignal.com/blog/2013/08/22/long-running-processes-in-php/

Lorna Mitchell:
Twitter Search API Using PHP and Guzzle
July 11, 2013 @ 12:49:45

Lorna Mitchell has a new post to her site today showing how she connected to Twitter with Guzzle, the popular PHP-based HTTP client (also used in the Amazon Web Services PHP client).

In case you missed it, Twitter updated their APIs recently, so that you have to authenticate to use even their search APIs to return publicly-available results. This is an increasing trend for API providers, to provide either very limited or nonexistent access for unauthenticated users, I think so they can rate limit consumers that swamp them. To cut a long story short, that meant I needed to update my dashboards that keep an eye on twitter searches to do more than just call file_get_contents in the general direction of the right URL.

She walks you through the creation of the client complete with the OAuth plugin (included with Guzzle) to make an OAuth request to api.twitter.com. With the client created, she shows a simple search call to the "tweets" endpoint.

0 comments voice your opinion now!
twitter search guzzle tutorial http client oauth api

Link: http://www.lornajane.net/posts/2013/twitter-search-api-using-php-and-guzzle

SitePoint.com:
How to Add OAuth Authentication to Your Twitter App
June 26, 2013 @ 11:27:53

In this quick post to SitePoint, they show you how to use the Twitter OAuth library to connect your application with the new Twitter OAuth authentication methods.

Thanks Twitter. Not only have you removed open access to public Twitter timelines, you're expecting developers to contend with cryptic authentication documentation! Many of us simply want to display our own tweets on our own website, but it's obvious Twitter prefers us to use their widgets. Despite the convoluted Twitter instructions, implementing OAuth in your lovingly-crafted API 1.0 application is reasonably straight-forward if you use the libraries provided by talented group of (non-Twitter) developers.

They break it down into a few easy steps (largely made easy because the library does most of the heavy lifting for you):

  • Create your Twitter Application
  • Create an Access Token
  • Download the OAuth Library
  • Modify Your Timeline Fetching Code
0 comments voice your opinion now!
twitter oauth tutorial library example api authentication

Link: http://www.sitepoint.com/twitter-1-1-oauth-php

PHPBuilder.com:
Oauth Authentication for Social Apps in PHP
February 08, 2013 @ 10:27:18

On PHPBuilder.com today there's a tutorial introducing you to OAuth and how to use it in your PHP applications.

Oauth is an open standard for authorization that allows secure authorization from web, mobile and desktop applications. This standard allows a third-party application to gain access to a HTTP service, i.e. it enables users to share their resources from one website with another website without having to give out their credentials (usually username and password). [...] Oauth authorization is carried out in 3 steps: obtain a request token, authorize request token and exchange request token for an access token.

They introduce you to some of the basic concepts behind OAuth and how the process works (complete with a handy graphic). They then show how to use OAuth to connect to the Facebook API, both in Javascript then PHP. This is followed with two other examples referencing popular social sites Twitter and Foursquare, hitting their APIs with simple authentication requests.

0 comments voice your opinion now!
oauth authentication social application twitter facebook foursquare tutorial



Community Events





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


introduction laravel voicesoftheelephpant series code threedevsandamaybe community language podcast conference symfony deployment interview list release framework zendserver api bugfix tips

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