The SitePoint PHP blog has a new tutorial posted showing you how to interact with the GitHub API via PHP thanks to the KnpLabs library to create a simple automation system to perform some simple tasks.
Github is one of the best ways to share code and collaborate. In this article, we are going to learn how to consume their API and how we can use it to accomplish some of our daily tasks. We are going to explore some of the daily tasks that can be accomplished through the Github API and build a small app using Laravel to illustrate the use cases. You can check the final result on Github.
They walk you through the setup of an application on the GitHub side and how to configure the related settings in your Laravel application. He shows how to bind the GitHub library to the app, set up some sample routes and build out controllers to:
- List repositories
- View repository content
- Editing files
- Viewing commits
Each item includes the code you'll need to make it happen, an example of the output you'll get from the API and how to use the data on your side in your views.