RFC: Convert PSR-3 LogLevel to PHP 8.1+ Enum

21 views
Skip to first unread message

Junaid Farooq

unread,
Aug 28, 2025, 6:28:40 PM (10 days ago) Aug 28
to PHP Framework Interoperability Group
Hello PHP-FIG Community,

I'd like to propose a modernization enhancement to PSR-3 (Logger Interface) that would convert the current LogLevel class with string constants to a PHP 8.1+ backed enum while maintaining backward compatibility.

I have attached an md file to this email that mentions all the details of the RFC.

I believe this change represents a natural evolution that enhances PSR-3 without compromising the stability and wide adoption that makes it such a successful standard.

Thank you for your time and consideration. I look forward to the discussion.

Best regards,
Junaid Farooq
RFC_LogLevel_Enum_Proposal.md

Jordi Boggiano

unread,
Sep 1, 2025, 5:07:32 AM (6 days ago) Sep 1
to php...@googlegroups.com, Junaid Farooq

The main issue is that these are not equivalent because enums do not cast to string..

https://3v4l.org/TMoYI#v8.4.12

You'd have to use LogLevel::DEBUG->value to be equivalent. I had to do the same when migrating to enum for Monolog v3.

IMO this is not worth the breakage it'd cause.

Best,
Jordi

Junaid Farooq --
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/php-fig/88b6a5e1-aab5-4d4a-bb40-c9f199812665n%40googlegroups.com.
-- 
Jordi Boggiano
@seldaek - https://seld.be
Reply all
Reply to author
Forward
0 new messages