Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hehihik's avatar

What does __() mean?

I inherited a Laravel script and saw the following code in the view

{{ __('products.header') }}

What does __() mean and what does it do for me?

0 likes
3 replies
Snapey's avatar

__() is a function that translates the text into the current language

So, in the translation files, there should be a string with the key 'products.header'

The translations can be found in /resources/lang

1 like
bobbybouwmann's avatar
Level 88

This is localization for application.

You should be able to find the translations files in resource/lang. In there, you find the language directory and then the products file. There should be a header key in there with the translation. The value from the translation file will be printed in the view.e key basically.

Documentation: https://laravel.com/docs/8.x/localization#introduction

2 likes
hehihik's avatar

Thank you for the quick reply. I have to pick bobbybouwmanns answer because he gave the most information.

Please or to participate in this conversation.