Using GitHub webhooks in Laravel 5

If you need to integrate your GitHub repositories with your Laravel 5 application, you are in the right place. We will be implementing GitHub webhooks in Laravel 5 using Secret token as authentication method.

For this example I’ll be creating a new config file for simplicity, but you can use any of your config files.


In your /config  folder add the file github.php  with the following content:

In the folder /App/Http/Middleware  add the file GitHubSecretTokenMiddleware.php  with the following  content:

Add the new middleware to the $routeMiddleware  array in /app/Http/Kernel.php , should look like this:

Finally add your routes using the github webhook middleware in your routes.php  file