13 ms·
I am currently working on a web application with two PHP components - one light base application in vanilla PHP, and an administration app driven by the same SQ
by colecut 7y ago
I am currently working on a web application with two PHP components - one light base application in vanilla PHP, and an administration app driven by the same SQL database using Laravel.
I am having a complete joy building these components, and I find two things to be striking:
My base component does not use a single dependency and it accomplishes a lot! It is really amazing what can be done in PHP with very few lines of code without the help of ANY external libraries, efficiently. I use PDO for connecting to the my SQL database, which is available natively... It can all just be very simple.
On the flip side, my administrative component is driven by Laravel, which yes, took heavy inspiration from Ruby on Rails, but by this point has greatly surpassed it and is very powerful and enjoyable to use.
PHP is the only server side language I would say I have achieved mastery in, so while I am naive to what could be better in X or Y language, I never currently feel held back for what I need to do, and I enjoy doing it.
If you are working in the web niche, what are the reasons not to choose it?
- mpartel 7y agoI mean, it's no longer horrible I guess :) With mainstream languages, there's rarely any single clear and/or insurmountable problem, it's all the little annoyances you run into every day that add up, plus the cognitive load imposed by the language directly as well as indirectly through the code it lets you write. I'm not 100% up to date on how much PHP has closed the gap in the last few years, but subjectively I never found it anything but tedious due missing features, various unnecessary pitfalls (sometimes with security implications), silly limitations (you can write a static type in this case but not in that, you can catch this error but not that, no inner classes, etc etc.), and numerous other small cases of poor "ergonomics". The "batteries included" nature of the standard library is nice, and in contrast to the somewhat fragmented world of RubyGems or NPM it can feel downright pleasant, but finding a SQL library or such is a pretty small effort in the scope of a project, and (popular) 3rd party libraries tend in my experience to be better than the equivalent standard library stuff in most of the languages I know. Every time I wrote a non-trivial amount of code with PDO, I had to look up the correct initialization rituals to get sane settings and copy or recreate a bunch of more or less "obvious" helpers. I'm sure there's something better in Composer by now.
- colecut 7y agoThere has been substantial gap closing in the past few years and I understand where a lot of the initial hate came from. This fairly-recent hour long talk covering the 25 year history of PHP by its creator was very good, if you're into that sort of thing =) https://www.youtube.com/watch?v=wCZ5TJCBWMg https://www.youtube.com/watch?v=wCZ5TJCBWMg As someone who works in web I have to deal with javascript also, and always enjoyed that too, until node and npm became standard tools. Now everytime I have a project that involves npm I end up wanting to tear my hair out eventually.. I have not had similar issues with Composer.
- calibas 7y agoIf you don't have to mess around with PHP extensions, then it all works like magic. Depending on your environment and which extensions you need though, they can be a pain in the ass and then it's more or less the same as managing external libraries.
- colecut 7y agoThanks, I hadn't thought about that =)