Convert between Symfony HttpFoundation Request / Response and Swoole Request...
Today I was implementing an HTTP Server using Swoole. At its core, the code looks just like the Swoole HTTP Server example: <?php $http = new \Swoole\HTTP\Server("127.0.0.1", 9501);...
View ArticleLaravel 6 From Scratch Free Video Course
In this series, step by step, I’ll show you how to build web applications with Laravel 6. We’ll start with the basics and incrementally dig deeper and deeper, as we review real-life examples. Once...
View ArticlePHP Performance Tip: Use fully-qualified function calls when working with...
TIL: When working with namespaced files in PHP it’s a huge performance win when using fully-qualified function calls. ~ If you’re calling is_null in your code, PHP will first check for the function’s...
View ArticleDemystifying Dependency Injection Containers
Video from Kai Sassnowski’s talk at Laracon EU 2019: The goal of this talk is to explain how dependency containers work by building our own. We start out by building the simplest DI container possible...
View ArticleLaravel Valet not picking up php.ini changes, a fix
If you have Laravel Valet not picking up php.ini changes, try this: .@laravelphp Valet wasn't detecting any of the changes I made to php.ini. Restarting brew services and restarting Valet had no...
View ArticleComposer Inline Aliases: Fake a PHP Package Version by Aliasing a Specific...
Great tip by Mattias: TIL: you can fake package versions in composer using the "as" alias. Useful to force install certain versions while keeping other dependencies in check! 👍https://t.co/VzmMRCCoR5 —...
View ArticleSharing PHP-CS-Fixer Rules Across Projects and Teams
Tim MacDonald shares a way to sharing PHP-CS-Fixer rules across your projects. It involves in setting up on repo/package that contains the rules and a little helper class that takes in a...
View ArticlePHPUnit: A Security Risk?
The author of PHPUnit was a bit surprised when he received a mail stating that PHPUnit was a security risk and hackers could remotely execute PHP code through a file named eval-stdin.php that ships...
View ArticlePHP 8 in 8 Code Blocks
Brent has been following the PHP releases and featured up close. In this post he highlights 8 of the features that will make it into PHP 8 Attributes (aka Annotations) Union types The static return...
View ArticlePHP: Convert a Geolocation (Latitude / Longitude Coordinates) to a Timezone...
Part of a PHP project I’m working contains a list of sites/buildings. For each site/building we monitor some data, for example its energy usage. We decided that we wanted to generate a...
View ArticleLegacy to Laravel: How to Modernize an Aging PHP Application
The folks at Tighten: In this post, I’ll present some strategies we use at Tighten to convert legacy apps to Laravel gradually over time, without needing to perform a full rewrite. Whether you’re...
View ArticleParse the output of git log using PHP
This gist might come in handy one day: <?php declare(strict_types=1); include 'vendor/autoload.php'; use loophp\collection\Collection; use loophp\collection\Contract\Operation\Sortable;...
View ArticleConvert Guzzle requests to curl commands with namshi/cuzzle
The other day the namshi/cuzzle PHP pacakge came in really handy. This library let’s you dump a Guzzle request to a cURL command for debug and log purposes This way I could test some things on the...
View ArticleFront Line PHP – Building modern web applications with PHP 8
The folks over at Spatie are at it again, this time with Front Line PHP. An ebook on cutting edge tactics in PHP 8, accompanied by videos and practical examples. The videos covering the new additions...
View Articleibis — A PHP tool that helps you write eBooks in markdown and convert to PDF
Mohamed Said recently wrote the book “Laravel Queues in Action”. To create the book he wrote it Markdown and then used his self-created tool ibis to generated the PDF and ePub versions. Installation...
View ArticleRun Composer Scripts in Parallel with veewee/composer-run-parallel
Nice addition to Composer by Toon Verwerft which allows you to run your custom commands in parallel This composer plugin allows you to run the tasks inside your composer file in parallel. No more...
View ArticleIt’s not legacy code — it’s PHP
In 2004 Vimeo wrote their first backend code in PHP. 16 years later and they (mainly) still run PHP. Many developers wrote a bit of PHP a decade ago and have since moved on to better-respected...
View ArticleRay – Dump Debugging Evolved
The folks over at Spatie have released a new tool called Ray that helps you with debugging. Ray is a beautiful, lightweight desktop app that helps you debug your app. After installing one of the...
View ArticlePHP Curl Security Hardening
Good post — with accompanying code — on PHP.Watch on how to tighten the almighty curl: Limit Curl Protocols Do not enable automatic redirects unless absolutely necessary If redirects are enabled...
View ArticleUnconventional Autoloaders in PHP
Recording from the October 2020 edition of Laravel Worldwide Meetup where Liam Hammet (starting at 36:58) showed off some nice use cases for custom autoloaders in PHP: We use autoloaders in PHP all...
View Article