Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free
  • By Gary Hockin
    Developer Webinars Developer Webinars

    Developer webinars are live coded presentations aimed squarely at our fellow builders.

    Upcoming webinars:

    Recent webinars:

    Read More
  • By Gary Hockin
    Five Exciting Features in PHP 8 Five Exciting Features in PHP 8

    It's getting close. PHP 8 will release on November 26th 2020, and I, for one, couldn't be more excited. Equally exciting was that June marked the first alpha release of PHP 8.

    I've been playing with PHP 8 since Derick Rethans introduced me to the features on a live stream and I'm hooked on the shiny new features we're getting. So here, months in advance are the 5 things I'm most excited about in PHP 8.

    Disclaimer: only features actually implemented are in this list, I'll likely make another list later with the things that aren't created yet.

    Constructor Property Promotion

    Let's be clear, these …

    Read More
  • By Gary Hockin
    Verifying Email Addresses in PHP Got Easy Verifying Email Addresses in PHP Got Easy

    As web developers, we end up creating a ton of login systems, and part of the “create user” flow is invariably verifying that the email address entered by the user is real, and owned by that person.

    Typically we'll verify the email address by sending an email to that address with a unique token as a query parameter in a link that the recipient should click. Creating the forms and handling the data entry is relatively easy in PHP; we have libraries and frameworks that can help with these everyday tasks. But nobody wants to configure and maintain a mail server to send out email verification requests.

    Luckily for us, Twilio Verify now supports email verification so we can send email verification requests complete with an auto-generated token with a single API call to Twilio. Once our user has clicked the link, we can validate the token is correct with …

    Read More
  • By Gary Hockin
    My 3 Favourite Things From Laravel 7 My 3 Favourite Laravel 7 Features

    Laravel 7 has released. And like any proper major release, it's packed to the rafters with new and exciting features. It's time to take a look at three of my favourite new features, and, if we're lucky, there might be a bonus feature at the end.

    You’ll need some existing knowledge of PHP and a little Laravel knowledge to follow along. You can find the sample code used in this article on GitHub.

    Custom Casting with Eloquent

    Eloquent, Laravel's object relationship mapper is a useful tool for moving data between our database and our code. We could do some sensible type conversions using Eloquent’s Mutators already. For example, add any field to the $dates property of our model and it is automatically converted into a Carbon date object for us.

    Custom Casts take this a step further by helping us to decouple how our data looks in …

    Read More
  • By Gary Hockin
    Laravel 7 : mes trois outils préférés Laravel 7 : mes trois outils préférés

    Laravel 7 est disponible ! Et comme pour chaque nouvelle sortie digne de ce nom, il est blindé de nouvelles caractéristiques intéressantes. Il est l’heure de jeter un œil à 3 de mes fonctionnalités préférées de cette version, et si on a de la chance, il y aura peut-être un bonus à la fin.

    Pour pouvoir suivre ce tutoriel, vous aurez besoin de connaissances en PHP, ainsi qu’un peu de savoir-faire avec Laravel. Vous pouvez retrouver le code de cet article sur GitHub.

    Cast personnalisé avec Eloquent

    Eloquent est un mapping objet-relationnel. C’est un outil utile pour gérer la data entre notre base de données et notre code.

    On pourrait déjà faire des conversions de type sensibles en utilisant Mutators de Eloquent. Par exemple : ajoutez n’importe quel champ pour la propriété $dates de notre modèle et il sera automatiquement converti en un date objet Carbon pour nous.

    Custom …

    Read More
  • By Gary Hockin
    PHP 7.4 - 6 Compelling New Features Graded PHP 7.4 - 6 Compelling Features Graded

    PHP 7.4 has arrived, and it's shipped the usual raft of exciting features and improvements. For a recent live stream, we looked at all the features in the release notes and figured out what each one means in a coding sense. Let's take a look at some of the new features in PHP 7.4, and grade each one from A-F depending on how interesting they are, and my excitement to use them.

    Note: This is my personal opinion based on my own unique experiences and opinions. You'll probably disagree with some of my grades, and that's good. Your opinions and experiences are different from mine. Let me know in the comments or on Twitter where you feel I went wrong.

    Typed Properties

    We've been waiting for this feature since PHP 7.0 introduced scalar type declarations and return types, and I, for one, am very excited. We can now set …

    Read More
  • By Gary Hockin
    Adding Twig as a View Renderer to Slim in PHP Adding Twig as a View Renderer to Slim in PHP

    Slim is an excellent PHP micro-framework. Out of the box it gives you compatibility with PHP standards (PSRs), PSR-11 for the container, PSR-7 for HTTP messages and PSR-15 for middleware. Its lightweight design gives you the bare minimum to get started with your web application; routing, a middleware dispatcher, error handling and a container. You need to wire up the additional services needed to handle requests and return responses.

    But where do we start? Let's take a look at installing a clean installation of Slim from a community skeleton, and add our first component to it; the Twig templating engine.

    Starting with Slim

    Slim provides a skeleton application that lets you get started quickly, but it's designed more with an API in mind than a web application. I prefer to start with a more lightweight skeleton from Slim maintainer Rob Allen. Rob’s starter comes with PHP-DI dependency …

    Read More
  • By Gary Hockin
    Securing Webhooks from Twilio in PHP Securing Webhooks from Twilio in PHP

    Webhooks make up the backbone of interactions with services like Twilio. When an event happens on one of our numbers, maybe it receives an SMS, then Twilio sends an HTTP request to our server with information on what happened. Typically we'll reply with instructions on how to respond to the event, perhaps we'll want to reply with an SMS of our own.

    Diagram showing how SMS messages interact with Twilio and your application

    Webhooks make interacting with events from Twilio really straightforward, but they also open our application to be manipulated in unexpected ways. If someone knows your webhook URL, they can craft HTTP requests to generate fake events that were never intended.

    To protect from counterfeit requests Twilio includes a signature header X-Twilio-Signature in every webhook sent to your server. We can use our secret Twilio authentication token plus the data submitted to the server to generate our own signature. We can then compare this to the header signature to …

    Read More
  • By Gary Hockin
    Static Analysis with Psalm PHP Copy of Generic Blog Header 4-10.png

    PHP is great, but its loosely-typed goodness is a double-edged sword. On the one hand, it gives PHP the legendary low barrier to entry, but on the other, magical type juggling inevitably means bugs.

    Because PHP is an interpreted rather than compiled language, catching these type problems is tricky, and often they'll go unnoticed for a long time before they catch up with us somewhere down the road. Problems sit and fester in our code base waiting to strike. Unused code can clutter our application, and there is a myriad of other ways in which we write PHP that won't produce errors but are bugs.

    There are some excellent tools to help us catch errors and find bugs before we even run our code. IDEs like PhpStorm can inspect our code and give us information on potential problems before a script is ever executed.

    Screenshot of PhpStorm IDE showing an inspection finding an unused variable

    Catching problems with our code before …

    Read More
  • By Gary Hockin
    What’s New in Laravel 6: Ignition and Flare Copy of Photo blog Header 1(1).png

    Laravel 6.0 is released, and as a new major version, there are plenty of fun new features for us to play with. The release notes give us all the highlights, but as part of a recent stream, I decided to take a look at one of the more exciting additions, the new error handler, Ignition.


    Ignition replaces Whoops as the default error handler in Laravel 6, but it works on older Laravel applications going back to version 5.5. The impressive thing about Ignition is because it's designed from the ground up to handle Laravel's specific errors, it can make suggestions on how to resolve errors, and even automatically fix common problems for us.

    If we deliberately add a typo in our blade template name, then Ignition realises this and suggests the fix for us in the green panel.

    Screenshot of Ignition detecting a typo of "homex" and suggesting that we meant to type "home"

    Even smarter is the fact that Ignition can automatically …

    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.