Live data from Hacker News

PHP – The Right Way

phptherightway.com

111–120 of 349 posts

Re: PHP – The Right Way

#111
post #88
post #77

Earlier quoted context omitted.

Quoted post unavailable.

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.

How do you feel about php7+ ? There were some serious changes.

Re: PHP – The Right Way

#112
post #70

Earlier quoted context omitted.

Isn’t this same thing? Your dir in python structure is dictating the namespace isn’t it?

The dir structure is defined by me. Namespaces are defined by the 3rd party developer.

That is not exactly true, you can tweak composer to put dependencies anywhere you want them. What I feel is that there is a minor inconvenience, as many other languages have, and you try to build a case to bring down a whole ecosystem.

Re: PHP – The Right Way

#113
post #34

I totally expected it to be a troll site. It's actually sensible advice. But, really, I suggest using other tools. We have nicer tools now.

I don't know that many nicer tools than Laravel, to be fair. Especially Laravel + Lighthouse, which is an extraordinarily neat GraphQL layer considering the huge deployability you get with PHP. PHP is progressing towards a nicer language in a way that JavaScript, IMO, is not. And taking tens of millions of programmers with it.

You should also have a look to api-platform (https://api-platform.com/), it's based on Symfony and you can create Rest or GraphQL APIs with ease.

Re: PHP – The Right Way

#114
post #107

Earlier quoted context omitted.

> I don't think there's a good reason to design a language specifically for web projects. If that's how PHP works these days (I haven't used PHP in a decade or so), I'd suggest that might be a bad thing. It's very rigid, and if the language gets anything wrong that compromises the design of every project that uses it. Languages should provide simple primitives that frameworks and libraries build on. That has always b…

> That has always been the goal of PHP, to be a web framework in itself This is untrue. PHP was a templating language and form-handler first and foremost[1]. It took a long time for it to move out of that (I'd argue up to 5.6) and become an actual programming language rather than a template language on steroids. Edit: we still have to move out of template mode in every file by adding a So, essentially, we now have we…

We're saying the same thing :) Templating language (for the web) and handle forms (on the web) makes PHP a web-language first and foremost. That's also the impression I get from reading the following section from the Wikipedia page you linked:

> PHP development began in 1994 when Rasmus Lerdorf wrote several Common Gateway Interface (CGI) programs in C,[16][17] which he used to maintain his personal homepage. He extended them to work with web forms and to communicate with databases, and called this implementation "Personal Home Page/Forms Interpreter" or PHP/FI.

He was working on his homepage (on the web) and wanted to make it easier to handle forms and communication with databases. That's basically everything the early web could do, and PHP aimed to make that easier.

Re: PHP – The Right Way

#115

Earlier quoted context omitted.

> But, really, I suggest using other tools. We have nicer tools now. Debatable really. Within the web development space the options are rather limited in my opinion. Options: * Spring based apps - Downside JVM is a Resource hog * Python, Ruby, etc - The web frameworks are in my opinion not as full featured. Same with CMS systems. Also requires more resources. Also have limited OO features. * Go, Rust, etc - Really go…

We use Asp.NET and it is a giant surprise how good it is. We are unix ppl, Linux & MacOS so not a MS shop at all. We deploy to on-prem and AWS so no Azure.

Same here, the latest asp.net is definitely one of the best performing options out there (maybe except rust in this list), and C# is a great general purpose language to code in (despite the legacy that's in there, like the reflection going on in the framework. unfortunately).

Re: PHP – The Right Way

#117

A 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 some esoteric ones like Haskell, a LISP or OCaml. Then see what they have to say PHP and JS for beginners.

Re: PHP – The Right Way

#118

Earlier quoted context omitted.

Not only that, I can almost guarantee that computers were involved in all of those failing projects as well, yet are not receiving any blame for it. Neither does the chairs. Damn chairs always avoiding blame.

Come on, CPUs aren't bedroom project hacked to write a bit of HTML. The depth of knowledge required to make one chip dwarfs all of PHP powered websites.

How about "there are no sides only progress in different areas"? I'm not saying writing PHP is more "valuable" than designing chips. Besides that, what does that have to do with anything mentioned in this very thread?

Re: PHP – The Right Way

#119
post #28
post #20

My 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…

There is 'use as'. But it is infuriating having to namespace your code when a folder name/heirarchy could do.

Doesn't that shield you from FS/OS impl though? I often found it the only reasonable explanation (for java too)

Re: PHP – The Right Way

#120

PHP 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?

Post reply on HN