The SitePoint PHP blog has a new tutorial posted from Younes Rafie continuing their series about using the GitHub API from PHP. In this second part of the series he shows how to integrate the GitHub Webhooks with your applications.
In the first part of our series, we talked about the Github API and built a demo in the process. In this part we are going to explore the Webhooks API, and we will build a demo to showcase the API usage.
The demo application they set up gets a push request from the GitHub API and save the resulting data to a local database. They use Laravel 5 to build the application but it could easily be in any other framework (or just plain PHP). They're also deploying to Heroku, but again, you can use your own service. The article then shows you how to go and register a webhook in the repository on the GitHub site and create the "hooks" table to store the event name and contents of the request. He makes use of a JSON output route and the ChartsJs library to render a simple bar graph of the contributors to the repository based on the number of commits they've made.