How to handle GitHub webhooks in a Laravel application

Original – by Freek Van der Herten – 3 minute read

Whenever something happens in one of your repos on GitHub, you can configure a webhook to be sent to your app. This way, you can perform some extra logic when a particular event occurs on the repo. A silly example would be to send someone a mail when an issue is opened.

We've created a new package called spatie/laravel-github-webhooks that makes it easy to consume GitHub webhooks in a Laravel app. In this blog post, I'd like to tell you all about it.

Read more

Stay up to date with all things Laravel, PHP, and JavaScript.

Follow me on Twitter. I regularly tweet out programming tips, and what I myself have learned in ongoing projects.

Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Introducing Dinero.js

Link – v2.dinerojs.com

Using Dinero, you can perform mutations, conversions, comparisons, format them extensively, and overall make money manipulation in your application easier and safer.

The docs also contain a few falsehoods many developers believe to be true about money.

Read more [v2.dinerojs.com]

The State of Laravel survey

Link – stateoflaravel.com

Laravel celebrated its 10th anniversary a few weeks ago. Today it is the most popular PHP framework used by thousands of developers every day. The emerged ecosystem around Laravel is huge and new trends are popping up all the time. This survey is an attempt to gain insight into the representation of the diverse technologies and behaviors of this outstanding community.

Read more [stateoflaravel.com]

How to render markdown with perfectly highlighted code snippets

Original – by Freek Van der Herten – 6 minute read

When reading technical blogpost around the web, you might have noticed that code highlighting is not always perfect.

Shiki is the code highlighter that uses the textmate parser VSCode uses under the hood. The code highlighting it provides is near perfect, even when using modern syntax. It supports 100+ languages (via our package Blade is supported too), and all VS Code themes.

I'm proud to announce that we have released three new Spatie packages that make it easy to use Shiki in your PHP projects:

  • shiki-php: makes it easy to call Shiki from PHP to highlight a given code snippet
  • commonmark-shiki-highlighter: allows commonmark to highlight all code snippets in a markdown fragment
  • laravel-markdown: a batteries included Laravel package that offers a Blade component to easily render Markdown with highlighted code snippets and a class to render Markdown manually.

We're already using this package to render all our documentation pages, our guidelines, and this very blog you are reading.

Read more