The story behind our open source efforts original

by Freek Van der Herten – 15 minute read

This post was first published on 24daysindecember.net Chances are that you've never heard of my company Spatie. We specialise in creating Laravel applications for our clients. Our team is rather small: we consist of only 6 developers and one manager. On first glance we are just a web agency like…

Read more

17 Tips for Using Composer Efficiently

Martin Hujer shares some pretty good tips for working with Composer.

Although most PHP developers know how to use Composer, not all of them are using it efficiently or in a best possible way. So I decided to summarize things which are important for my everyday workflow.

The philosophy of most of the tips is "Play it safe", which means that if there are more ways how to handle something, I would use the approach which is least error-prone.

https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/

Read more

Join 9,500+ smart developers

Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

spatie/async will be released soon

My colleague Brent is currently creating a new package called spatie/async. This one will let you easily do some asynchronous parallel processing in PHP. In a new post on his blog Brent explains why we are creating the package and compares it to a few other solutions out there.

If you're into parallel PHP, you probably heard of Amp and ReactPHP. Our package aims not to compete with those two, as it only solves one tiny aspect of parallelism in PHP. We did however use both the packages to run some benchmarks against. Let's take a look at the results.

https://www.stitcher.io/blog/asynchronous-php

Read more

Some interesting numbers about the PHP GitHub repos in 2017

Marcel Pociot, author of BotMan, used GitHub and Google BigQuery to look up some interesting numbers about the PHP repos in 2017.

It's this time of the year again - the end of the year is coming up fast, so why not step back and take a look at what we, as a PHP community, have achieved this year?

For these statistics, I used the free GitHub Archive data in combination with Google BigQuery, which lets you process 1TB of data per month free of charge.

So let's take a look at some numbers.

http://marcelpociot.de/blog/2017-12-21-a-php-year-in-review

My team is mentioned in the article too. Pretty proud of this!

As you can see, Spatie - a company doing a ton of open source projects - is on this list 16 times. Well done ???? !

Read more

An async map function original

by Freek Van der Herten – 3 minute read

Laravel has an excellent Collection class that has many useful operations. The class is also macroable. This means that you can add function to it at runtime by calling macro on it and passing a name and a closure. In our projects we tend to code up the same macro's over and over again. That's why…

Read more

Laravel-medialibrary v7 preview: media collections original

by Freek Van der Herten – 5 minute read

laravel-medialibrary is a package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. Like mentioned before on this blog my team and I are currently creating a new major version, v7,…

Read more

My VS Code Setup

In an absolutely fantastic post Caleb Porzio, engineer at Tighten Co., goes through his VS Code setup. He goes over his extensions, key bindings, must-have settings, ...

I’m using VS Code as my primary editor these days and am really digging it. My setup is by no means perfect, but I've made lots of little tweaks along the way that you may benefit from. I've set up these nifty categories, so feel free to jump around and try stuff out as you go, or come back later and use it as a reference.

http://calebporzio.com/my-vs-code-setup-2/

I've made the switch from PhpStorm to VS Code a couple of weeks ago and have been using it ever since. I like the speed improvements over PhpStorm, the zen feel, the xdebug experience, ... It just feels lighter (and I mean that in a good way) compared to PhpStorm.

If you want to give VS Code a shot too, go watch the free Visual Studio Code for PHP developers course on Laracasts.

Read more

Laravel-medialibrary v7 preview: multi file downloads original

by Freek Van der Herten – 4 minute read

laravel-medialibrary is a powerhouse package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. My team and I are hard at work creating a new major version, v7, that adds a lot of…

Read more

Installing PHP 7.2

PHP 7.2 was released last week. Here's a nice post highlighting the most important changes. If you want to know how to install PHP 7.2 on your system, Colin O' Dell has got you covered.

PHP 7.2 has been released, bringing some great new features and security enhancements to the language such as object type hints, saner count() behavior, and much more. Here's a brief guide on how to install PHP 7.2 on several different operating systems.

https://www.colinodell.com/blog/201711/installing-php-72

Using brew on MacOS it's very easy to upgrade from PHP 7.1 to PHP 7.2. Just run these:

brew update
brew upgrade
brew unlink php71
brew install php72

Please be aware that, at the moment of writing, there isn't a stable xdebug version that works for PHP 7.2. Keep an eye on the xdebug homepage to know when a stable version drops.

Read more

24 Days in December: thoughts of the PHPamily

24 days in december is a site where every day, from start of December until Christmas, a new post by someone in the wide PHP community is published. The blog authors are hand picked by Andreas Heigl who runs the site. Here's an excerpt of the post by Kalle Sommer Nielsen that was published to today.

PHP has a tremendous community behind it, that community consists of you and me, and millions of others that help promote PHP by continuing to develop awesome applications that power some of the biggest websites in the world, but within this community exists a relatively small community that actively develops PHP, such as making it run on your favorite platform or making your favorite extensions compile and work or even keeps the documentation up-to-date. Today I want to dwell into that community, and perhaps giving you flavor enough to contribute back to PHP with code

https://24daysindecember.net/2017/12/11/giving-back-to-php/

Be sure to check out the posts by Morten Bergset, James Titcumb, Juliette Reinders Folmer and all others too.

Read more

Symfony 4: New Hope

In an article on his Medium blog, Jerzy Zawadzki wrote about the most important changes made in Symfony 4.

Internally, Symfony 4.0 is “just” Symfony 3.4 with removed depracations. But from outside there is a big leap forward. Most changes (from the installation process, directory structe through using bundles, to coding itself) were made to improve Developer Experience with the framework. Such system like Symfony, which can be used to create web apps as easily as to build other frameworks on top of it, must be complicated. But, as Symfony proves in new version, this complexity may be ‘hidden’ from the developer eyes.

https://medium.com/@zawadzki.jerzy/symfony-4-new-hope-dbf99dde91d8

Read more

Symfony now has an improved dump function original

by Freek Van der Herten – 2 minute read

Let's talk a little bit about Symfony's dump function. It's part of their VarDumper component. The function can dump a variable to the screen or browser in a nicer format than PHP's native var_dump. In the recently released Symfony 3.4 and Symfony 4 the function got a nice little improvement that…

Read more

A package to use optimised UUIDs in Laravel

Using regular UUIDs stored as a text-based primary key is very slow. Our newly released package spatie/laravel-binary-uuid aims to solve that by binary storing a slightly tweaked version of the UUID. My colleague Brent wrote a blogpost describing how it works behind the scenes. He also included some interesting benchmarks.

The binary encoding of UUIDs solved most of the issue. There's one extra step to take though, which allows MySQL to even better index this field. By switching some of the bits in the UUID, more specifically time related data, we're able to save them in a more ordered way. And it seems that MySQL is especially fond of ordered data when creating indices.

https://www.stitcher.io/blog/optimised-uuids-in-mysql

Read more

murze.be turns three original

by Freek Van der Herten – 2 minute read

Three years ago I started this blog to share my bookmarks and interesting links with fellow developers. Like on the previous anniversaries I'd like to share some cool statistics from the past 12 months. For the period spanning from end november 2016 until end november 2017 my little blog served 591…

Read more

An approach to testing middleware

Laravel rockstar TJ Miller posted a short and sweet post how how he tested a middleware that forces requests to respond with JSON.

So what I’ve done here is define custom testing routes and applied the middleware as I would use it in the application routes, in this case global middleware and as middleware for the api group. This allows me to assert that the middleware is configured and functioning correctly.

https://medium.com/@sixlive/an-approach-to-testing-middleware-c547fc942848

Read more

How to Read Big Files with PHP (Without Killing Your Server)

In a new blogpost published at Sitepoint, Christopher Pitt explores the various ways you can handle reading big files in PHP.

Though this isn’t a problem we frequently suffer from, it’s easy to mess up when working with large files. In asynchronous applications, it’s just as easy to bring the whole server down when we’re not careful about memory usage.

This tutorial has hopefully introduced you to a few new ideas (or refreshed your memory about them), so that you can think more about how to read and write large files efficiently. When we start to become familiar with streams and generators, and stop using functions like file_get_contents: an entire category of errors disappear from our applications. That seems like a good thing to aim for!

https://www.sitepoint.com/performant-reading-big-files-php/

Read more