Tag Archives: php

Snapshot testing with PHPUnit

use Spatie\Snapshots\MatchesSnapshots; class OrderTest { use MatchesSnapshot; class test_it_casts_to_json() { $orderId = new Order(1); $this->assertMatchesJsonSnapshot($order->toJson()); } } Again great work by the folks at Spatie: The difference between a classic assertEquals and an assertMatchesSnapshot is that you don’t write the … Continue reading

Elsewhere , , Leave a comment

Easily manipulate images in PHP with spatie/image

Great new package by the folks at Spatie to working with images in PHP, powered by Glide. Glide itself is great, but uses an URL based approach (which has its benefits); yet in most cases I find myself using a … Continue reading

Elsewhere , , Leave a comment

Private Packagist

Mid-December Nils Adermann – Co-Founder of Packagist Conductors & Creator of Composer for PHP – announced Private Packagist. Being a hosted service, setting up your own Composer package repository on Private Packagist is done with a few clicks. No matter … Continue reading

Elsewhere , , , Leave a comment

Facebook Live Reactions

Facebook Live Reactions is a Linux script for creating Facebook Live Streams that contains interactive reaction counts. It also includes an interactive shoutout feature that gives live shoutouts to users who typed “shared” into the comment box. The livestreaming itself … Continue reading

Elsewhere , , , Leave a comment

Using XDebug with PHPStorm

We assume that you use PHPStorm on a daily basis, and this guide will help to debug your code locally using the IDE. A remote debugging guide will come in the future. Make PHPStorm your new home – Configuring and … Continue reading

Elsewhere , , Leave a comment

(Laravel) Uptime Monitor

Today Freek from spatie released a new package: Laravel-uptime-monitor is a powerful, easy to configure uptime monitor. It will notify you when your site is down (and when it comes back up). You can also be notified a few days … Continue reading

Elsewhere , , , Leave a comment

Getting ready for PHP 7.1

In short: Catching multiple exception types Curl HTTP/2 server push support Support class constant visibility Void return types Generalize support of negative string offsets Allow specifying keys in list() and square bracket syntax for array destructuring Warn about invalid strings … Continue reading

Elsewhere , Leave a comment

Minify: A JavaScript and CSS Minifier Written in PHP

MatthiasMullie\Minify is a JavaScript and CSS Minifier written in PHP. Usage is straightforward: use MatthiasMullie\Minify; $sourcePath = '/path/to/source/css/file.css'; $minifier = new Minify\CSS($sourcePath); // we can even add another file, they'll then be // joined in 1 output file $sourcePath2 = … Continue reading

Elsewhere , , , , Leave a comment

Improving readability using array_filter

Great trick by Freek Van der Herten: instead of selectively adding fields onto an array after having verified them to not being falsy – resulting in lots of if blocks in the code – it’s actually a lot easier/readable to … Continue reading

Elsewhere , Leave a comment

Validating SSL certificates with PHP

Great stuff again by Freek Murze from Spatie: A PHP class to easily check the validity of an SSL Certificate. Easily? Yes, easily: $certificate = SslCertificate::createForHostName(‘spatie.be’); $certificate->getIssuer(); // returns “Let’s Encrypt Authority X3” $certificate->isValid(); // returns true if the certificate … Continue reading

Elsewhere , , Leave a comment