Live data from Hacker News

Go with PHP

gowithphp.com

421–430 of 532 posts

Re: Go with PHP

#421
post #416

Earlier quoted context omitted.

PHP 8 is a vast improvement over PHP 5. Also, the frameworks have become much better - I especially love the Yii framework as well as the Codeigniter framework if you are looking at a Rails replacement.

I'm a Go dev these days and rather looking into TS and Rust. I was just curious to be honest. With RoR being what it is PHP frameworks has to offer something on the same level (at least) to be of any interest (as a I see it). Not to mention ecosystem\packages\gems\etc.

It is ridiculously easy to setup a full CRUD environment in frameworks such as Yii. It is as simple and selecting some options on a screen and then clicking on a button. The example below is from 7 years ago!

https://www.youtube.com/watch?v=Xi0gH2izUy0

Re: Go with PHP

#422
post #307

"500,000 orders per month" That's like, what, 12 orders per minute? Is this meant to be impressive or something? I bet any language run on a modern laptop can handle that.

"when hosted on a $6/month server" Dropping half a sentence will often make it sound goofy, yes. The point being made is "you don't need a massive K8s infrastructure to handle hundreds of thousands of orders a month". Most people don't; https://www.joelonsoftware.com/2001/04/21/dont-let-architect... is an oldie but a goodie on the subject.

[deleted]

Re: Go with PHP

#423
post #307

"500,000 orders per month" That's like, what, 12 orders per minute? Is this meant to be impressive or something? I bet any language run on a modern laptop can handle that.

"when hosted on a $6/month server" Dropping half a sentence will often make it sound goofy, yes. The point being made is "you don't need a massive K8s infrastructure to handle hundreds of thousands of orders a month". Most people don't; https://www.joelonsoftware.com/2001/04/21/dont-let-architect... is an oldie but a goodie on the subject.

Unpopular opinion: If you use k8s mostly for scaling, you're using it for the wrong reasons.

Also the numbers are still irrelevant for the server because if you do 500k orders a month you owe it to the users to respond faster than 1s and also be highly available (just take 3 servers somewhere idc about anything else)

Re: Go with PHP

#424
post #245

Earlier quoted context omitted.

I don't know why you are being downvoted, this is a very legitimate question. These server-side frameworks are all alive and kicking and very competitive. When some other smaller ecosystem comes up with a good idea (like elixir/phoenix) there is a rush to replicate which happens rather fast. I think in the end the competition will lead to specialization. Python will almost certainly capitalize on its data science / M…

Rails console, metaprogramming, elegant blocks, procs & lambdas, Turbo/Hotwire. Concise Ruby language vs PHP framework code with hideous inlined fully-qualified method paths.

all of that pretty much is available and arguably much better in Elixir/Phoenix

Re: Go with PHP

#425

> Read the following code as if it were a documentation page: If I read this as a documentation page, this makes me scared: `Order::create($validated + ['status' => 'pending']);` What does it mean to add an array to something?

Exactly the same as the spread operator in JavaScript or even the exact same syntax in Python, but we don't hear you complaining about those, do we?

No complaints about the spread operator :-) But the plus in javascript produces this:

    [1,2,3] + [1,2,3]
    // '1,2,31,2,3'
(never tried this in js before; so was amused by the result)

Re: Go with PHP

#426
The problem with PHP is not that you can't write great maintainable codebases in it -- you certainly can.

The problem is how easy it makes it to write obscenely unmaintainable anti-architected code bases in it. The average PHP production code base is deeply offensive. I'm knee deep in one right now.

You can still have awful code bases in Rails or Django or Go, but the opinionated nature of those ecosystems makes the average much better than PHP.

If "PHP" were synonymous with "Laravel", that would be different. But it's not.

Re: Go with PHP

#427

Developer advocacy is such a weird thing, do it right and people will line up for you to mentor them and pay you for it, do it wrong and you will people scratching their heads asking "so you can do with this thing what you could do with Perl + CGI 15-20 years ago and still not get more performance out of it?". Sadly this article is the latter. I'm working on both sides of the fence -- dynamic strongly typed language…

> Is the whole thing prone to N+1 queries like Rails is (was? no clue about it nowadays)?

Rails has had the ‘include’ method which solves n+1 since version 3.0 around 2010. Before that it also had preload which worked similar.

Re: Go with PHP

#428
post #407

Earlier quoted context omitted.

That's really the point. The code is deceptively simple for a whiz-bang "look how easy this is!" kinda presentation but the reality is that it's not useful for anything but a toy web store. Maybe it's fine that it only works 99% of the time if you're just trading Pokemon points, but not when you're dealing with people's money.

I'd argue that a vast majority of web applications are not "dealing with people's money" so there's not a need to code for such cases. The right tool for the right job, etc. etc.

I'd argue being able to stop worrying about your code after writing it and not making decisions like these is a good enough reason to just do it right. Especially when it's not much more additional work

Re: Go with PHP

#429

Earlier quoted context omitted.

> Just ignore the fugly standard library inconsistencies of (old) PHP, every language has their toilet corner... Personally, I do like the way the standard library is - almost all cases of where people whine about it being inconsistent, it is a consequence of the PHP standard library and many of its extensions being extremely thin wrappers around libc and C/C++ libraries in general. That, in turn, makes it often poss…

>> That, in turn, makes it often possible to just take straight C library example code, copy it into a PHP file, add a $ in front of all variables, and have it magically work. * head explodes awesome I know what I'm doing this afternoon!

Writing PHP bindings is pretty easy as well (once you manage to sort out build tooling, but that's a mess anywhere in C). Have fun :)

Re: Go with PHP

#430

Earlier quoted context omitted.

I've tried Laravel, it's a beautiful framework. But I see no reason to switch from Rails, it's a beast.

Hi! I'm looking for advice on how Rails vs Laravel compare (as I'll have to pick one of them soon for a project). Assuming the same knowledge and familiarity on both of them, why would you prefer Rails over Laravel? Thanks!

The reason why I stuck with Rails is because I am already a Ruby user. I like PHP and all but I am way more comfortable with Ruby.

I don’t think there is anything Rails can do that Laravel cannot and wise versa.

It’s about taste.

I think Rails + hotwire hit the sweetspot for me!

Post reply on HN