Live data from Hacker News

PHP – The Right Way

phptherightway.com

251–260 of 349 posts

Re: PHP – The Right Way

#251
post #77

Actually, that make me remember statements of Linus Torvalds on Git at Google Tech Talk Conference: But I did end up using CVS for seven years at a commercial company and I hated it with a passion. When I say I hate CVS with a passion, I have to also say that if there are any SVN users in Subversion, users in the audience, you might want to leave because my hatred of CVS has meant that I see Subversion as being the m…

Quoted post unavailable.

> pointless hearsay

This such a typical response of people who live in a bubble, and get angry when nobody else in the real world agrees with their insane ideas.

Just because people think PHP is garbage doesn't mean they don't know what they're talking about. In fact, in my experience, the hatred many experience people in the industry have of PHP almost always comes directly from having been forced to use it.

In my case, I've worked on several large PHP projects (100k+ sloc, developed over 10+ years by many people) and it's by far the single worst language and set of tools I ever used.

Literally everything from the language, to the runtime, to the standard library, third party libraries, etc. is just complete and utter amateur hour, and is done so much better in almost any other language ecosystem out there.

I'm glad you're somehow able to make it work for you, but don't pretend it's good. It's really not.

Re: PHP – The Right Way

#252
post #247
post #214

Earlier quoted context omitted.

Quoted post unavailable.

> If you don't check what you pass to count() it's really not php's problem, it's your programming. this is a horrible take, language semantics should never change in a backwards-incompatible way. This is API design 101.

But in fact the semantics did not change within the minor revision boundary. This was an ordinary deprecation process, as it should be. Emitting a warning is not breaking anything!

Re: PHP – The Right Way

#253

I want to like PHP, but it seems that there are so many better/modern alternatives out there, IMHO Go and Rust are the most notable new ones, Go is almost (if not yet) ahead of PHP in terms of community and resources (learning and packages), while Rust still needs a few years to establish (the async issue and few others) and the maturity of the ecosystem, there are no killer solution yet (maybe there will never be).…

Not sure about your experience with Laravel, but I don’t see how the type system is bad for it. It works surprisingly well for me. With a bit of tooling I get even autocompletions for database fields when using Eloquent. PhpStorm with the (paid) Laravel plug-in are pretty awesome and give me more information during file-editing than for example Xcode. Laravel has also a pretty active and productive community and so m…

It also could be that the learning curve is steep to get some things done and this was a side project that I wanted to get done. That could have contributed to my bad experience, also I'm not developing in php professionally anymore and sometimes when I want to get shit done, but this time it didn't worked for me.

I would not go with nodejs/deno because it doesn't feel a resilient foundation, let's say you put your php server out there, it wouldn't crash easily or if it "crash" would not kill the entire server, so there are benefits with php in that regard, it feels more easy to fire and forget.

Go should have my go to, but because never used didn't wanted to go that route, then Rust that is more painful than php in regard of the frameworks, there are not so mature ecosystem in the web category, but I can build a resilient system with rust, even I could write plain old sql that get's validated at compile time[1], that sounds amazing (well there are few drawbacks, but I like to be able to freely refactor the app in the future and the tooling tells me where I broke it, and with all other alternatives, except Go, there is no such library).

So this is more personal preference and php didn't meet my expectations, that doesn't mean that php is bad, but for me and my use case is, we cannot blame to php yet, but I think the core developers must push even harder the type system, offer better 1st party tooling and more guaranties in regard of the integrity of your program, this is one take of rust that if it compiles it works so when you do code review you only need to review the logic :)

[1] https://github.com/launchbadge/sqlx

Re: PHP – The Right Way

#254
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.

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

> Downside JVM is a Resource hog

The fuck are you smoking? The JVM is one of the most mature, resource efficient, and fast language runtimes out there.

See, this is why nobody can take you people seriously.

Re: PHP – The Right Way

#255
post #80

Earlier quoted context omitted.

What server language today except PHP (and its forks) is actually designed for the web and works as the web was intended? The implication of the question is that there's something designed into PHP that makes it better for working with web things. Why does the language need to be designed to work with the web? That part of any language can be filled out with a framework quite easily, and arguably that means it's much…

> Languages should provide simple primitives that frameworks and libraries build on. This had tons of disadvantages. Say CoolLang is such a language. Since is msall CoolLang has a micro standard library so has no DateTime or JSON, so you have a package manager and maybe 1 repo where 15 different JSON packages, you decide to use JSON_A but you also want to integrate with Amazon and they used JSON_B in their API and yo…

CoolLang sounds a lot like JS.

Re: PHP – The Right Way

#256
post #78

Earlier quoted context omitted.

This is roughly PHP’s approach. In this case, Illuminate is the vendor prefix and Mail is the package name. This often but not always corresponds to the rules around the composer package name, which would be illuminate/mail in this case. This is similar to NPM’s organisation prefix (@foo/bar). But yeah, I’m not defending the hacky way namespaces are resolved through autoloading. I do prefer actual language support fo…

I actually prefer auto-loading, which lets you iterate through a package manager much easier/faster - PHP iterated through PSR-0[0] before landing on PSR-4[1], and you can always build your own (which is what most frameworks pre-composer were doing). With Rails 7 and Zeitwerk, the Ruby community has landed on a very similar auto-loading system as PHP now[2] with constants translating to paths by convention. [0]: http…

Yeah, I prefer an actual module system over PHP namespaces plus autoloader. It feels like a hacked on module system tbf. BUT I do get lots of real work done using namespaces and a PSR autoloader so it works.

I do wish they would extend auto loading for standalone functions and constants though.

Re: PHP – The Right Way

#257
post #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?

Laravel and its ecosystem is really great. I used to hate PHP, but now I find it quite enjoyable, at least in the realm of building websites.

If you stick to modern versions and frameworks, it's a much different experience from PHP 8 years ago.

Re: PHP – The Right Way

#258
It's a decent website - a useful collection of information and links to additional information, that can serve as a starting point to learn more. For those who use PHP, or for those who'd like to learn to use it, this might be useful resource.

The same thing can't really be said of the comments in here though. I don't see how emotionally charged debates over what is the "best" or "worst" language, help anyone.

It's almost as if some people can truly have their ego shattered, by someone on the internet liking another language than they do...

Couldn't we just agree that there is no "best" language for every possible use case, and that everyone is allowed to like whatever language they want to like? It's not like the whole bickering is going to change anyone's opinion.

Re: PHP – The Right Way

#259
post #214

Earlier quoted context omitted.

I was curious about this rant since I'm maintaning a number of PHP projects and I haven't had any issues with "count". In the Changelog section of the "count" docs at https://www.php.net/manual/en/function.count.php we find: > 7.2.0 - count() will now yield a warning on invalid countable types passed to the value parameter. So in 7.2.0 they started raising a warning in cases where the application was doing a stupid t…

Quoted post unavailable.

Before 2017-12-01, the documentation for count() said:

> Returns the number of elements in array_or_countable. When the parameter is neither an array nor an object with implemented Countable interface, 1 will be returned. There is one exception, if array_or_countable is NULL, 0 will be returned.

If the languages developers did not want programmers to use that behavior they should have said that it is undefined when the input is not an array or countable. When you document how something behaves in any particular case programmers are going to use it, especially in a case like this where the behavior is actually useful.

Re: PHP – The Right Way

#260
post #90

Earlier quoted context omitted.

Java, .net, C#, typescript (not my favorite) are all commonly and often used for Web Development. They are sane languages with large ecosystems and solid frameworks for web-dev.

The question is not can you use something else, it's are they nicer/better tools to work with. I haven't for example seen many things that can honestly compete with WordPress. When it comes to eCommerce, not many systems can compete with Magento/Spryker/Sylius. The list goes on. PHP is a top player in web development while being one of the most hated languages for a reason. I've spent a lot of time using PHP professi…

  > not many systems can compete with Magento/Spryker/Sylius
I'm evaluating eCommerce solutions for a Magento 1 upgrade path. I'm already evaluating Magento 2 and Sylius, but I've yet heard of Spryker. I found the PaaS offering, but even from their Github account I don't see any PHP application that would be an alternative to Magento or something based off Sylius. If you have any links or further information I've love to know. Thanks.
Post reply on HN