Talk in English - US at PHP TEK 2025
Track Name:
Wrigley Field
Short URL: https://joind.in/talk/c7065
(QR-Code (opens in new window))
Do you wish that PHP had features that other languages have? Have you got some great ideas about how to extend PHP's feature set but don't want to go through the RFC process?
Great news. There is another way. It is possible to implement some new language features using static analysis.
This talk will briefly introduce the PHP Language Extension library; which offers features such as Java's package level visibility and C++'s friend feature. Then, we'll take a deep dive into how to create a custom PHPStan rule.
By the end of the talk, hopefully you'll be inspired to create your own enhancements to PHP, or at the very least have a starting point to write your own custom rules.
Comments
Please login to leave a comment
I'm not sure how I'm going to implement this and work yet but I will be installing the language extensions when I can get our PM to allow me to add it to the sprint.
I've gone down the path of custom PHPStan rules for enforcing things like type usage and coding standards but it was very illuminating to see all of the different examples Dave shared from the PHP Language Extension library. So much great AST content at tek this year!
This was a very interesting discussion. Had no idea such a thing was possible. Not exactly sure how I might use it, but thanks Dave for imparting your knowledge!
Excellent explanation of whats happening under the hood and a great crash course on the usefulness of custom Attributes. I can’t wait to check out the packages.
It was all very clearly stated and easy to follow. I appreciated getting both the “how” and the “why”.