DEV Community

Discussion on: PHP needs its own ES6

Collapse
 
mnavarrocarter profile image
Matias Navarro Carter

Great article. I think the main problem with it all is that PHP is so widely used that core maintainers have a very strict policy of not breaking the api. But I think PHP 8 will deal with more api changes.

As a side note, I don't know how many BC changes ES6 brought to JS, but I'm inclined to think that they were new features mainly.

In any case, you should check Nikita's Scalar Objects extension. I've tried it before and has been great pleasure to work with. It really empowers you a lot, because it let's you define your own api over the native types.

Collapse
 
hamatti profile image
Juha-Matti Santala

Yeah, maintaining backwards compatibility is the key. And it's very crucial stuff because such a huge part of the Internet runs on PHP.

ES6 was an extension but for me, the things that made me fall in love with it (after a quite a while of opposition) were the changes into how Javascript is written. () => {} shorthand for functions, class shorthand, template literals, etc.

Thanks to this article, I've learned of a few ways to write more enjoyable PHP so I'm pretty happy about that. Scalar Objects extension looks pretty neat, thanks for the tip!