Earlier quoted context omitted.
PHP still has a vibrant ecosystem. 1) cost 2) simplicity 3) scalability With the advent of Chinese frameworks that solve C1000K problems like swoole, workerman and so on it even found its place as high performance interactive backend server.
I spent the better part of 2021 porting a PHP app to Kubernetes. If there’s one thing PHP is not, it is performant.
PHP – The Right Way
141–150 of 349 posts
Re: PHP – The Right Way
#142The reason why people now care about PHP is that, decades ago they thought PHP would the right way to develop projects, now they are stuck, because they cannot get rid of PHP any more. If you look at any well grounded projects, they try to avoid PHP at all cost. Only handful amount people are responsible for core development. Decision are made based on "copying" other languages like Java, plus you always end up using…
A poor developer can make any tool look bad.
Re: PHP – The Right Way
#143PHP is actually a really decent option these days. And several libraries and frameworks built around it are flourishing.
> And several libraries and frameworks built around it are flourishing. Yes. > PHP is actually a really decent option these days. I beg to differ. What comparative options do you have experience with to base your claim on?
PHP has an amazing infrastructure of third-party libraries/packages around it, particularly if you're using PHP for web development. In comparison, Python simply does not have the same quality of framework for web like Symfony or Laravel. Django is good, but just that - good. And then there's the matter of speed with Python which is by all metrics slower than PHP.
Then there's node. Node is significantly faster than PHP, but all that speed is wasted away because of all that nightmarish mess that is node_modules. Node infrastructure for backend web dev is nowhere near close to where PHP or even Python is.
Re: PHP – The Right Way
#144A language that changes the semantics of functions between minor versions has no "right way". "count()"less examples of crap. I have currently two weeks of code migration behind me because code running correctly on 7.0 fails on 7.3 -- while I see the reason for change was necessary I also see the hopelessness of rebuilding a flawed house with a fundament build on a pile of manure. And the good news given to me by a c…
Totally agree. This is beyond taste or preference. Yes you can build a great app in PHP. But so you can in Kotlin or Ruby or ... Yes some have a career by starting with PHP. But that does not make it a good language for beginners. Same can be said (and to me is verrrry true) fro JavaScript. Language design matters. It shapes how you think about code. Talk to people who've learned AND USED many languages including som…
* A welcoming, helping and open community.
* Built-in guidance or enforcement away from The Wrong Way and towards The Right Way. E.g. by making the former hard to do and the latter easy.
* Ecosystem of high-quality, properly designed libraries and sample code.
I see this in e.g. Rust. But e.g. JavaScript or PHP fail on all my three points. As does my main language, Ruby, sadly.
Re: PHP – The Right Way
#145Earlier quoted context omitted.
> I haven't for example seen many things that can honestly compete with WordPress. I'm sorry? Compete on what parameters? Almost all frameworks win, hands down, in developer-friendlyness from WordPress. Many, if not most, modern CMSes can easily compete on security or performance. Many CMSes will win in user-friendlyness - for distinct use-case even more so. Many web-frameworks win easily in versatility: there's no w…
The fact you're talking about building a payment service provider in a CMS kind of tells me this isn't a conversation worth continuing.
Re: PHP – The Right Way
#146Earlier quoted context omitted.
I, for one, would chose PHP8 over Javascript all day, every day. And there seem to be millions like me.
Well... I wouldn't recommend JavaScript. TypeScript is much nicer and removes a lot of the JS pitfalls.
With PHP you can have your cake and eat it too. Have the productivity of a dynamic language, no compile step and a really smooth gradual typing experience with great tooling and linting.
I really can't think of anything other that familiarity why one would prefer JS/TS for server side stuff. Maybe async story but PHP 8 got fibers now so it might be catching up soon as well.
Re: PHP – The Right Way
#147A language that changes the semantics of functions between minor versions has no "right way". "count()"less examples of crap. I have currently two weeks of code migration behind me because code running correctly on 7.0 fails on 7.3 -- while I see the reason for change was necessary I also see the hopelessness of rebuilding a flawed house with a fundament build on a pile of manure. And the good news given to me by a c…
Totally agree. This is beyond taste or preference. Yes you can build a great app in PHP. But so you can in Kotlin or Ruby or ... Yes some have a career by starting with PHP. But that does not make it a good language for beginners. Same can be said (and to me is verrrry true) fro JavaScript. Language design matters. It shapes how you think about code. Talk to people who've learned AND USED many languages including som…
In fact JS is much more pleasant to write than PHP, the main reason to move way from PHP after using it for over 10 years.
Re: PHP – The Right Way
#148My problem with PHP is that it solves the issue of code reuse the wrong way round. In other languages, you can import code like this: import mail as mailer The external code ("mail") does not have to make assumptions how it will be called when it is used. In PHP, it is the other way round. Every piece of code needs to try avoiding namespace conflicts by prefixing the code with something like this: namespace Illuminat…
Namespaces in PHP are totally fake, they are not real as it is in C++, where you can actually store data within them. In PHP the namespace is just a name added to every class construct and nothing else. This is basically class MyThing the same as this namespace My; class Thing However namespaces was a pragmatic design choice that solved the community's problem with code organization and ever increasing project sizes…
Is the strict_types dance necessary for this?
I really hope that if PHP introduces an import system, it does not combine it with stricter type handling.
Re: PHP – The Right Way
#149Earlier quoted context omitted.
Why do you presume this is "hearsay PHP hatred"? I (not parent) have PHP hatred. It is fuelled by decades of PHP development and -exposure. My hatred is based on failing projects, missed deadlines, burnouts, money stolen, severe downtime, and companies going bankrupt. PHP had a role (not the primary, mind you!) in all of them.
It looks like your projects employed PHP poorly. PHP has been great for my company and my developers. We have never had to face such grave consequences because of it, and we've employed it in companies generating millions of $ of revenue. I will pick it over any other interpreted language.
One mistake was that PHP was chosen, when it really was unfit for the task at hand. Another one was that CMSes like WP or Drupal were shoehorned into projects that were really unfit for them. etc. But also being unable to upgrade underlying PHP versions due to breaking changes, or just p*ss-poor, bug-ridden PEAR packages. As well as the language design prohibiting proper TDD, isolation, etc.
I explicitly said that PHP was but one of the causes. But the language-design and the community certainly did play a significant role. I explicitly never said that you cannot achieve properly designed and maintainable software with PHP. I know you can, because I've also encountered many of those.
Re: PHP – The Right Way
#150Earlier quoted context omitted.
You can manual include I don't think that will work with any code that came out in recent years. Because it all expects that its dependencies are automagically included via composer. In practice, every PHP based web application starts with Laravel or Symfony these days. So you are thrown into the composer workflow right away. And it would be a nightmare to fight it.
Nope. I don't use these frameworks. But thanks for trying to assume how php is on 2022 and how all php devs work.