> 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?
This could be rewritten as: Order::create([...$validated, 'status' => 'pending']);
Go with PHP
441–450 of 532 posts
Re: Go with PHP
#442There's 2 things to separate here: 1. PHP the language and developer experience (frameworks, tools, community, docs, etc) 2. PHP performance at scale In my experience, PHP is much improved for 1. and fine to work with. Laravel and composer are great. For 2. I would never use PHP on anything above a few hundred requests a second. It's slow on its own, but more importantly it's blocking IO model will grind things to a…
Weird that you get down-voted but I lose more and more respect for HN these days so I can only say I am not surprised that a common-sense post was given the gray treatment. I have the same experience as you, I've participated in migrating from PHP to JS, to Elixir, and to Golang. The transition to JS was mostly a performance disaster (not much performance was gained) but at least more devs could help so it was still…
Good to hear someone else has had a similar experience. Nothing against PHP at all, but it's definitely not suited for scale.
Re: Go with PHP
#443Earlier quoted context omitted.
> The magic in these frameworks is evil, and likely a big part in ruining PHP's reputation. Have you actually used Symfony? It's an absolute pleasure in its domain and includes rich debugging abilities through its dev toolbar.
I have, though I admit it's been about 10 years since and my memory may be mixing in (pun intended) things from version 1.
Re: Go with PHP
#444Earlier quoted context omitted.
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
#445I built and maintained open source frameworks in both. I left PHP for Go. 1. with http://sqlc.dev I don't have to write ORM or model code anymore. Define all your SQL in an easy to audit file and all your models and interfaces are generated for you. 2. with http://goa.design I can have well-documented OpenAPI API's that any team can generate a client for in any language. It also generates the HTTP JSON and gRPC clien…
The language has evolved since. The ecosystem has evolved since. Most of the things you're complaining about are solved paradigms that no one does manually anymore unless they're trying to drastically improve on ecosystem tooling.
Even your complaints about Laravel are solved by open source tooling in its own ecosystem.
Nothing about your preferences are really unique to go - most, if not all of these tools exist in many popular languages.
The one solid point you have is that go lets you do many of these things by default without adding anything. To which I say: Duh. Go doesn't have a massive ecosystem of backwards compatible projects to continue supporting. It was barely used outside of niche cases until 2-3 years ago. In 10-15 years time, I'm sure people will say the same things comparing Go to a newer language.
Re: Go with PHP
#446Earlier quoted context omitted.
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!
Re: Go with PHP
#447Earlier quoted context omitted.
I love PHP, but a red flag?! If they’re busy in the Ruby/Java/C#/Go worlds (all get-it-done environments) then I’d just assume they don’t read many Hacker News praises for PHP. It’s easy to have not encountered it since the bad old days unless you work on a team that uses Laravel for some things. I do understand hiring someone who has that tradesman programming ethic and is comfortable with Linux, but that’s more req…
Yeah, that's fair. Now that you mention it, 90% of these guys where I get that red flag instinct I described are Javascript devs or wannabe Javascript devs. It's as if the JS ecosystem has driven an entire generation of developers insane
Re: Go with PHP
#448Nice. I needed this today. I teach "Advanced" Web Programming and my classes start next week. I've been generally ignorant of most of the kazillion fancy Javascript frameworks and have more or less kept PHP as the base of the course. This is what more-or-less has felt right most of the time.
I'd expect to see some discussion of async job processing and front-end web frameworks in any advanced web programming course, high-school or college level. Honestly, just teaching the usual react stack with a typical node backend would probably be ideal since JS is approachable, react is still "cool", and you still only need to use one language.
Re: Go with PHP
#449Earlier quoted context omitted.
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
#450Earlier 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!