2 ms·
I'm not sure that PHP done like Java is "right."
by asciimo 13y ago
I'm not sure that PHP done like Java is "right."
- krapp 13y agoI think the best answer, probably, is that modern PHP done right uses some kind of framework, or at least a PSR-0 autoloader, url routing, proper data security and some kind of templating to separate the logic from the view. It can (and has been) argued that PHP is itself a templating language and that the added abstraction of something like Twig is unnecessary... while that's technically true, scaling that gets you trainwrecks like Wordpress' API, where it's all but impossible to write plugins without mixing html in with the code. You also get nice things like macros, auto-escaping, and caching with a template engine, and you would probably end up having to reimplement a lot of that at some point anyway. Although what Laravel uses (blade) for templating looks pretty close to bare PHP, so there's plenty of room for minimal abstraction. But all of it is light-years ahead of the nightmare that is typical legacy PHP.