TranslateCI makes human translations for your Laravel app as easy as using Git. Just push your code, and TranslateCI will take care of the rest. It scans for untranslated phrases, and uses professional human translators to support over 70 possible language pairs. When the translations are done, usually in less than 24 hours, TranslateCI makes a PR back to your repository. Check it out today!

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 I'd like to highlight in this post.

You probably already know that you can dump stuff like this:


Nothing too fancy. But if you did this in previous versions of the framework it would blow up:

// dump didn't return anything so method is getting called on null ☠️

I was quite annoyed with this so I submitted a PR to Symfony that let dump return the things that it was given. So now you can just wrap the function around any variable even if there are methods being called on it.

// in Symfony 3.4 and 4.x this just works ????

When dumping multiple things, they all get returned. So you could dump all arguments passed to a function like this.

$object->method(...dump($arg1, $arg2, $arg3));

If you are using Laravel you'll be happy to know that Laravel just uses Symfony's dump function, so you can make use of this little improvement in Laravel too.

Happy dumping! ????

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

Follow me on Twitter. I regularly tweet out programming tips, and what I myself have learned in ongoing projects.

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.