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

SitePoint PHP Blog:
Building a Hacker News Reader with Lumen
Mar 01, 2016 @ 10:40:41

The SitePoint PHP blog has posted a tutorial from author Wern Ancheta showing you how to use Lumen to make a simple news reader specifically for the content of the Hacker News website via their API.

In this tutorial, we’re going to build a reader for Hacker News. We will be using the Hacker News API and the Lumen framework to implement this.

The end result basically lists the top stories from the front page along with the current number of upvotes they've received. He first walks you through the process to get a new Lumen-based application up and running. The tutorial then helps you get a database set up to locally store the data (so it's not hitting the API every time) and add in the two basic routes. It then shows how to make use of the task scheduler functionality to create and perform the requests to the Hacker News API and fetching the latest items to store in the database. Full code is included to create the Guzzle HTTP client instance to make the requests and parse the results. Finally, he shows the creation of the index and news output pages including the controller, views and CSS to style the markup output nicely.

tagged: hackernews api news reader lumen laravel tutorial guzzle

Link: http://www.sitepoint.com/building-a-hacker-news-reader-with-lumen/