I'm currently organising Full Stack Europe. It's a conference in Antwerp, Belgium for developers who want to learn across the stack. You can use this link get your ticket with a nice discount.

Enabling PHP method chaining with a makeshift pipe operator

Link –

Sebastiaan Luca, a freelance Laravel developer from Antwerp, coded up a couple of functions that mimic a pipe operator.

An interesting RFC proposal by Sara Golemon submitted in April 2016 suggested the use of a pipe operator to enable method chaining for any value and method. Yet as of today, it's still being discussed and there's no saying if it will ever make its way into PHP. So in the meantime, here's a solution!


Let's hope a real pipe operator will land someday in PHP.

Stay up to date with all things Laravel, PHP, and JavaScript.

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.