Popular Photos, Filters and User Profiles with the 500px API

article

#1

Originally published at: http://www.sitepoint.com/popular-photos-filters-user-profiles-500px-api/

This entry is part 1 of 1 in the series Building a Custom 500px Laravel App

Building a Custom 500px Laravel App

  • Popular Photos, Filters and User Profiles with the 500px API

500px is a photo community for discovering, sharing, buying and selling inspiring photography. In this article we are going to explore their API and build a small showcase app. Let’s get started.

What We’re Building

In this article, we are going to build a small Laravel app with three main features. You can check the final result on Github.


  • The index page will contain the latest popular photos on the 500px website.

  • A filter will let the user choose from popular, upcoming, etc. and also sort the result according to votes, rating, etc.

  • A photographer’s profile page with the list of available photos will be available.

Setting up

Before using their API, we need to get some access credentials. After signing in to the website you can go to the application settings and register for a new test application. The consumer key and the consumer secret will be used for accessing the API.

We are going to use Guzzle to make HTTP requests, and Guzzle Oauth subscriber for using OAuth. If you are not familiar with these two, you can check out this Guzzle introduction and read about using Guzzle OAuth.

Popular Photos

Let’s first add the Guzzle packages to our composer.json and autoload our src folder where we put our authentication class. Run composer update to update our app.

// composer.json
...
"require": {
      ...
      "guzzle/guzzle": "3.9.*",
      "guzzlehttp/oauth-subscriber": "0.2.*"
},
"autoload": {
    "classmap": [
        ...
            "app/src"
    ]
}
...

Inside our src/PxOAuth.php file we are going to provide our consumer_key and consumer_secret to build our OAuth object.

Continue reading this article on SitePoint


closed #2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.