New in Symfony 4.3: Console Hyperlinks

Written by Symfony blog - - Aggregated on Wednesday December 19, 2018

Symfony 4.3 will be released in May 2019. This is the first article of the series that shows the most important new features introduced by this Symfony version.

Contributed by
Gabriel Ostrolucký
in #29168.

Creating advanced Console interfaces is important for lots of applications, even those which are not Console based but include some commands to perform certain tasks.

Rendering clickable hyperlinks is one of the most important missing features of Console apps and commands. Although most of the terminal emulators auto-detect URLs and allow to click on them with some key combination, it's not possible to render clickable text that points to some arbitrary URL.

However, some terminal emulators led by iTerm2 and GNOME Terminal, are working on a new specification to add support for this feature. That's why Symfony 4.3 added support for hyperlinks in the Console using the following syntax:

// hyperlink syntax: <href=THE_LINK_URL> THE_LINK_TEXT </>
$output->writeln('<href=>Symfony Homepage</>');
$output->writeln('<href=>View Issue</>');

If your terminal emulator is compatible, this is how you'll see these links:

Thanks to this new feature, we've started to improve the developer experience of some Symfony features, such as the links displayed in the VarDumper console output.

If your terminal does not support hyperlinks, they will be rendered as normal and non-clickable text and you won't see their URLs. That's why it's recommended to check out the growing list of terminal emulators that support hyperlinks before using this feature in your own apps and commands.

Be trained by Symfony experts - 2019-01-14 Clichy - 2019-01-14 Clichy - 2019-01-16 Clichy

« Makkelijk video streamen met Facebook … - Intracto

Laravel News - Laravel 5.7.19 Released »