Tag Archives: php

PHP Session Locking: How to Prevent Blocking Requests

Today I learned about “PHP Session Locking”: PHP writes its session data to a file by default. When a request is made to a PHP script that starts the session (session_start()), this session file is locked. What this means is … Continue reading

Elsewhere , , Leave a comment

Browsershot: Convert a webpage to an image or PDF using headless Chrome

The folks over at Spatie have just release Browsershot v3: Browsershot is a PHP package which can convert a webpage to an image or pdf. The conversion is done behind the scenes by Puppeteer which controls a headless version of … Continue reading

Elsewhere , , , , Leave a comment

Macroable – A Trait to Dynamically add Methods to a PHP Class

New package by the folks from Spatie: We recently released our newest package called macroable. It contains a trait that, when applied to class, can dynamically add methods to that class. This trait is basically a stand alone version of … Continue reading

Elsewhere , Leave a comment

Getting Ready for PHP 7.2

PHP 7.2 is planned to be released on 30th November 2017. And it comes with two new security features in the core, several smaller improvements and some language legacy clean-ups. In the article, I will describe what the improvements and … Continue reading

Elsewhere Leave a comment

Silex Routing vs Trailing Slashes

In Silex-based projects I always define my routes with a trailing /. When defining a route with a trailing slash, the router will respond to both the route without and with slash: $app->get(‘/hello’, …); will respond to http://localhost/hello but not … Continue reading

Elsewhere , , Leave a comment

Automatically rerun PHPUnit tests when source code changes with phpunit-watcher

Nice new package by Freek from Spatie.be. Think of it like Jest, but for PHP: Wouldn’t it be great if your PHPUnit tests would be automatically rerun whenever you change some code? This package can do exactly that. By default … Continue reading

Elsewhere , , Leave a comment

Zttp, a developer friendly wrapper for Guzzle

If you’re not familiar with the evolution of Guzzle, the library has basically gotten more professional and less usable with each new version. New layers upon layers of specification-respecting abstractions and rules made Guzzle incredibly difficult to get started with. … Continue reading

Elsewhere , , Leave a comment

Getting ready for Symonfy 4.0

Fabien Potencier, founder and project lead of Symfony: Symfony 4.0 will be released at the end of November 2017. During the next few weeks, I will publish articles about my ideas and the main changes I want to implement for … Continue reading

Elsewhere , , Leave a comment

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