How to check which version of PHP you are running

Original – by Freek Van der Herten – 1 minute read

When working on open source code, I like using the latest version of PHP. When developers that are not on the latest version use the package, they might see syntax errors.

You might ask why Composer doesn't protect against this? When composer.json requires the latest version, how do devs, not on the latest version, can even install the package?

Well, there seemingly are a lot of people that only upgrade the PHP version on the command line. For handling web requests, they are unknowingly using an older version of PHP. Here's how to make sure you are on the latest version of PHP on both the CLI and for handling web requests.

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.

Mailcoach v2 has been released with support for custom HTML editors and multiple mailers

Original – by Freek Van der Herten – 9 minute read

A couple of months ago, my team released Mailcoach, a self-hosted solution to send out newsletters. It sends out mail via services like Amazon SES, Mailgun, Sendgrid, and Postmark. It can optionally track opens and clicks. When your email list grows, this is a much more cost-effective solution when compared to a service like Mailchimp.

Mailcoach can be used as a premium Laravel package or as a stand-alone app. When installed into a Laravel app, it can be greatly customized. The Mailcoach stand alone app can be used without knowing how to program.

Today we're releasing v2 of Mailcoach. It offers support for Laravel 7, html editors, and multiple mailers, together with a bunch of quality of life improvements. In this blog post, I'd like to walk you through these features and show some technical details.

Read more

How to refactor complex if statements

Original – by Freek Van der Herten – 1 minute read

Have you every come across confusing if statements with complex conditionals such as this? I bet you did!

// please kill me 🤯 
if (!(($this->shipping_country == "GB" || (strcmp($this-status, "Valid") !== 0)) {

To me, this is completely unreadable.

In the video below I show how I deal with this situation. Spoiler: add some tests around it and break the conditionals apart.

This video is part of the Mailcoach video course. It contains many more videos on how to write clear code. You can use this coupon code to get a nice discount of $10.

YES-I-WANT-TO-WRITE-READABLE-CODE

Read more

Laravel Tail can now tail remote logs

Original – by Freek Van der Herten – 2 minute read

laravel-tail is one of my favourite packages. When installed in a Laravel app it can be used to tail the log file. To tail a log file locally, you just have to issue this command: php artisan tail and it'll start tailing the latest log file (so it works for both daily and single log files). Any line…

Read more

Pragmatically testing multi-guard authentication in Laravel

Original – by Freek Van der Herten – 2 minute read

Last week our team launched Mailcoach, a self-hosted solution to send out email campaigns and newsletters. Rather than being the end, laughing something is the beginning of a journey. Users start encountering bugs and ask for features that weren't considered before.

One of those features requests we got, is the ability the set the guard to be used when checking if somebody is allowed to access the Mailcoach UI.

In this blog post, I'd like to show you how we implemented and tested this.

Read more

Building Mailcoach

Original – by Freek Van der Herten – 12 minute read

Today, our team released Mailcoach, a beautiful, self-hosted mailing list manager. It integrates with services like Amazon SES, Mailgun, or Sendgrid to send out mailings affordably. It’s packaged as a stand-alone app, or can be integrated into a Laravel project, it's perfect for bloggers, artisans, and entrepreneurs.

Even if you're not in the market for an email solution, Mailcoach includes a video course on how it’s built. I'm sure you'll see some valuable techniques that you can bring to your own project.

In this blogpost, I'd like to share why and how we've built this.

Read more

Remove all history from a GitHub repository

Original – by Freek Van der Herten – 2 minute read

From time to time I need to remove all history from a GitHub repository, for instance right before releasing a package I've worked on in private. Sometimes I don't want people to see all mistakes I've made along the way :-).

Read more