TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go with PHP

549 pointsby eiiotabout 2 years ago

85 comments

keyleabout 2 years ago
As a fullstack developer who has worked many, many years in the javascript hellhole, I mean ecosystem, as well as the python ecosystem and .NET; coming back to PHP the last 2 years, working essentially in Laravel and the like - I couldn&#x27;t approve more of this message.<p>Seriously, PHP is the grand father that will drive you to class and you&#x27;ll never be late, the car will never smell and everything will always just be fine.<p>It&#x27;s fast, it&#x27;s typed (now), it&#x27;s reliable.<p>Laravel is pretty darn rock solid. I&#x27;ve used a LOT of frameworks. Most of them fall on their ass in either the documentation or performance scope. Laravel is beasty, reasonably well documented, handles hundreds of thousands of users without a scratch. Plays well with Redis and MariaDB or anything really.<p>Just ignore the fugly standard library inconsistencies of (old) PHP, every language has their toilet corner...<p>Oh and it&#x27;s free. All of it. PHP, Laravel. And its hosting has always been the cheapest. You don&#x27;t need a particular OS or certain cloud providers.<p>When I consider the solutions of flask and microservices I&#x27;ve left behind, the many node processes running with pm2, the complexity of .NET solutions... PHP just works, and it&#x27;s easy to make reliable... And if it&#x27;s slow, it&#x27;s because I&#x27;m doing dumb stuff, not because of dark corner edge case I happened to be tripping into.<p>It&#x27;s single threaded first, queue jobs for anything slower. That simple facts make it so much easier to reason about things, and keeps the fullstack linear, transactional and easy to reason about, 2 years into it.<p>PHP is not the best language in the world. I prefer Swift and even Go for many reasons, but it&#x27;s an easy, simple, straightforward language. It&#x27;s the BMX of the languages.
评论 #35897616 未加载
评论 #35897710 未加载
评论 #35897587 未加载
评论 #35900963 未加载
评论 #35898384 未加载
评论 #35899531 未加载
评论 #35899427 未加载
评论 #35898039 未加载
评论 #35898056 未加载
评论 #35897459 未加载
评论 #35901561 未加载
评论 #35902340 未加载
评论 #35898714 未加载
评论 #35903859 未加载
评论 #35898152 未加载
评论 #35902347 未加载
评论 #35899230 未加载
评论 #35898364 未加载
评论 #35897382 未加载
评论 #35901401 未加载
评论 #35897369 未加载
评论 #35900561 未加载
评论 #35900984 未加载
评论 #35900766 未加载
评论 #35902013 未加载
评论 #35899246 未加载
评论 #35899863 未加载
评论 #35901182 未加载
mholtabout 2 years ago
I&#x27;m in the group described halfway down: was on the Internet during PHP 5, lost interest in it, and moved on [to Go]. I haven&#x27;t written anything in PHP newer than version 5. Even transitioning from 4 to 5 was quite a big deal, I definitely noticed improvements.<p>But it wasn&#x27;t enough.<p>I couldn&#x27;t fit the data set in memory with PHP. But I could do it with Go.<p>I couldn&#x27;t do parallel computations in PHP in order to respond to an HTTP request quickly enough. But I could do it with Go.<p>I couldn&#x27;t reliably and easily deploy to different systems with PHP. But I could do it with Go.<p>Eventually, I couldn&#x27;t write a web server with PHP. But I could do it with Go.<p>A lot of my early websites were written in PHP and I was able to build them quickly and routinely. I didn&#x27;t really have a problem with PHP as a paradigm, or even its security and consistency posture. I&#x27;m glad they&#x27;ve since made an actual language spec and fixed a lot of issues with it. And I don&#x27;t judge or look down on PHP programmers. I just don&#x27;t think it was the right tool for my jobs.
评论 #35897820 未加载
评论 #35898197 未加载
评论 #35898112 未加载
评论 #35898144 未加载
评论 #35900491 未加载
评论 #35897660 未加载
评论 #35899066 未加载
评论 #35897725 未加载
评论 #35901551 未加载
pdimitarabout 2 years ago
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 &quot;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?&quot;.<p>Sadly this article is the latter.<p>I&#x27;m working on both sides of the fence -- dynamic strongly typed language (Elixir) and static strongly typed languages (Golang, Rust) -- so I am already sold on the advantages of dynamic languages. That page is doing a poor job selling PHP to me though, f.ex. it&#x27;s not clear when you do `$request-&gt;user-&gt;orders`, does that automatically go to the DB? Does it first fetch the user and then all their orders, or does it do it in one go? Is the whole thing prone to N+1 queries like Rails is (was? no clue about it nowadays)?<p>Posting cute little coding snippets is skipping 99% of the story. The code must <i>remain</i> small and simple and understandable and easy to dissect &#x2F; troubleshoot, long-term, and allow for adding metrics &#x2F; telemetry, analytics and such.<p>So OK, we get it, you&#x27;re so hyped about PHP that you made a website about it. Alright. Now do a cookbook. Next show us a 5-year old project and tell us how long does it take to add a feature or fix a bug exactly. Tell us of the issue that took you the longest to troubleshoot -- and why did it take so long.<p>Before that this is basically a surface-level marketing page that says almost nothing and is not even accentuating the strong sides of your loved technology because what I am seeing here I can clearly remember 5 other languages I&#x27;ve done it successfully with: JS, Golang, Elixir, Rust and Ruby.
评论 #35903419 未加载
nologic01about 2 years ago
Planet php has a strange and probably unique geography. It has its large continent of modern generic web frameworks but it also has these countless small but thriving islands of specialized platforms that solved specific problems.<p>But islanders and continentals dont talk or help each other.<p>You can obviously build from scratch a blog, a wiki, lms, forum, analytics, e-commerce, survey etc. etc. site in Laravel. The funny thing is that it is quite likely that the <i>leading</i> open source solution for what you want to do is already in php (wordpress, mediawiki, etc) yet you cannot benefit much from it. You definitely cannot import it, but you cant even learn easily from it unless you dig deep into a complicated codebase.<p>Because php is so old and so adapted to web development people went on and built wonderful things with it, capturing complex domains with all their peculiarities. But that valuable knowledge base remains fragmented and locked within each one of these monoliths.<p>Going forward there is ever more intense competition between open source language ecosystems. A lot of improvement efforts look inward (making languages faster, safer).<p>The php community might also be able to draw unique advantage looking more &quot;externally&quot;, taping the enormous domain knowledge of all these projects. How that could be done in practice is an open question, but it could become the USP for php, the way data science has become for Python.
JodieBenitezabout 2 years ago
Why do most PHP related posts on HN read like repentance ? If you want to promote the language -to the point of buying a domain and making a webpage-, please show interesting stuff, not something that is equally trivial to solve in gazillions of web frameworks written in gazillions of languages.
评论 #35908469 未加载
评论 #35913598 未加载
CR007about 2 years ago
I&#x27;ve been using PHP for about 19 years and what I can tell is that both the language and its community have evolved the right way. Writing modern PHP is a joy, IDE support is great and we have tools for everything.<p>Modern PHP is about community standards, not about any particular framework and exposing Laravel as the best way to get started with PHP is questionable. I wouldn&#x27;t recommend it to anyone wanting to learn (real) PHP.<p>The article praises PHP but it is sad that doesn&#x27;t link to any other resource or project which ditches the value of PHP community.<p>Laravel is great for RAD which is attractive for small projects. The kind of stuff &quot;business with 500K orders runs on a $6 VPS&quot; thing. For clients wanting a robust software system you can use a better tool.
评论 #35902128 未加载
评论 #35944054 未加载
评论 #35909720 未加载
janmoabout 2 years ago
&gt; Your website is automatically protected against XSS, session hijacking, CSRF, SQL injection, host header attacks, and other vulnerabilities.<p>That&#x27;s quite misleading however
评论 #35897235 未加载
评论 #35899988 未加载
评论 #35901028 未加载
评论 #35897895 未加载
latchkeyabout 2 years ago
&gt; There is no need to compile anything.<p>But I really like compilers, they catch a whole class of bugs, before I run things.
评论 #35897658 未加载
评论 #35899912 未加载
评论 #35899523 未加载
评论 #35897598 未加载
scstepsabout 2 years ago
It’s cool to see PHP getting its second heyday once again. It’s currently a perfect storm of two communities starting to notice PHP. From the JavaScript side, people are comparing React with PHP, and on the bootstrapped start up side, people are talking about just using a single index.php file for your entire product without dealing with a complex tech stack as inspired by Pieter Levels.
评论 #35898171 未加载
o1y32about 2 years ago
&quot;500,000 orders per month&quot;<p>That&#x27;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.
评论 #35901270 未加载
评论 #35901193 未加载
评论 #35902196 未加载
评论 #35901240 未加载
languagehackerabout 2 years ago
I am an erstwhile PHP apologist. Having come back to PHP after a long time away (not really by choice), I can confirm that the language has improved significantly since PHP5. PSR was a huge success in a lot of ways. However there are still a few things that prevent it from being my language of choice.<p>First off, there is a surprising number of core behaviors you&#x27;d expect from a modern web application that there isn&#x27;t a clear go-to for in the PHP world. Does anyone know of a well maintained library for publishing and consuming AMQP messages asynchronously?<p>PHP is still limited by living inside of the context of the request. This has an effect on certain types of application-layer caching, and makes for a poor model for backend scripting.<p>You also still need to interact with multiple layers of dependency management -- from os packages to pear packages to composer libraries. Configuration can be messy, and many projects still aren&#x27;t containerized.<p>Finally, while the language has evolved, many of the projects that use it have not. The longer lived the PHP project, the more likely you are to encounter the exact paradigms that make it so hard to work with. Other languages have benefitted from a much greater percentage of their lifespan being supported by ecosystems that encouraged keeping your dependencies and the parts of your code that exercise them up to date.<p>That being said, it&#x27;s great to see that there is a path for starting new projects with a modern framework. But I would have said the same thing about Zend or Symfony, and those seem to have fallen off for reasons I don&#x27;t know.
评论 #35902249 未加载
taspeotisabout 2 years ago
&gt; It can handle more than 500,000 orders per month<p>How many seconds in a month? 60 * 60 * 24 * 28 = 2,419,200.<p>So basically, its performance is at least 0.2 requests a second...
评论 #35897732 未加载
评论 #35897855 未加载
评论 #35897423 未加载
评论 #35897442 未加载
评论 #35897789 未加载
评论 #35900655 未加载
rrdharanabout 2 years ago
They’re not wrong… PHP7+ is blazing fast, has a huge library, gradual typing support, etc.<p>If starting a new project in the space where they all “compete”, I would choose PHP7 or PHP8 with Laravel or Symfony (or maybe even WordPress) over Rails, Django and probably over NodeJS.
评论 #35897416 未加载
评论 #35899581 未加载
hankchinaskiabout 2 years ago
Laravel is probably the top reason why I moved away from PHP to Go. I find it frustrating to have to learn custom DSL and custom syntax to do basic stuff. Which then of course if you learn is going to be useful until the next major version of the framework, at which point you will have to re-learn everything over again. I like how I can just know the Go standard library go into dozens of different projects and still being able to contribute because there are no custom frameworks and DSLs.
joering2about 2 years ago
I think its a great reminder to code with whatever you feel comfortable. For example, my last project I did in Centos&#x2F;Apache&#x2F;PHP5&#x2F;Code Igniter 3.1 with some WASP for protection I did for 12 years and sold few months ago. It checks out against Qualys Server test and ImmuniWeb very well. I sold it for close to $10MM with annual revenues of $1.6MM. The last question the new owner asked me was &quot;what did you program it with?&quot;. They mostly want bunch of boring excel spreadsheets seeing where I am, how the sales are sustained, and how do I believe it can grow. On the final day, their IT guy showed up. He looked in silence through 45 minutes of my code&#x27;s presentation, which is very much mix of OO and not OO, and his only words were &quot;I don&#x27;t like frameworks if that was me I would start the whole thing from scratch&quot;.<p>So you never know what or whom you gonna get, but the bottom line is if you have sales and revenues and keep tabs on spending, they will come, and they will not care less about your fancy framework or newest code implementations.<p>TLDR: code in whatever you feel comfortable but always consider security as top priority (not speed) because in production your code&#x27;s&#x2F;setup security mistakes can cost you serious legal troubles.
评论 #35897495 未加载
chasilabout 2 years ago
I was expecting something about Go.
评论 #35897431 未加载
评论 #35897180 未加载
评论 #35897410 未加载
Xeoncrossabout 2 years ago
I built and maintained open source frameworks in both. I left PHP for Go.<p>1. with <a href="http:&#x2F;&#x2F;sqlc.dev" rel="nofollow">http:&#x2F;&#x2F;sqlc.dev</a> I don&#x27;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.<p>2. with <a href="http:&#x2F;&#x2F;goa.design" rel="nofollow">http:&#x2F;&#x2F;goa.design</a> I can have well-documented OpenAPI API&#x27;s that any team can generate a client for in any language. It also generates the HTTP JSON and gRPC clients&#x2F;servers for me so I can focus on my logic.<p>3. with <a href="https:&#x2F;&#x2F;github.com&#x2F;99designs&#x2F;gqlgen">https:&#x2F;&#x2F;github.com&#x2F;99designs&#x2F;gqlgen</a> I can define GraphQL revolvers that play well with sqlc (any RDBMS) or I can use a key-value store.<p>4. speaking of key-value stores, Go allows them to be embedded! Even SQLite now has the <a href="https:&#x2F;&#x2F;litestream.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;litestream.io&#x2F;</a> project to make it super simple to use a durable, always backed-up SQLite database even in a serverless context.<p>Go is faster, uses less memory, uses types, has built-in formatting, package management, benchmarking and testing. Go supports multiple cores in the same process, and has really-well designed stdlib without all the bugs I used to face trying to use the PHP stdlib.<p>After writing millions of lines of PHP for years, there is nothing I miss anymore. Laravel still wants me to write models, controllers and views by hand and make all the client changes as by-hand code refactors.<p>Go lets me focus on the actual logic instead of waste my time in PHP writing all the implementation details like controller requests handlers, db fetching logic, and input validation.
评论 #35903957 未加载
Uptrendaabout 2 years ago
Also: lets not forget one very important and under-rated side-effect of PHP -- it lets you write server-side code that can leverage a &#x27;public&#x27; address. You might think &#x27;well, doesn&#x27;t everything let me do that?&#x27; Not quite. On &#x27;free&#x27; VPS servers they usually have &#x27;ephemeral&#x27; IPs or IPs that change. So while you get free bandwidth and compute -- it&#x27;s hard to actually do anything useful with it like run a service if you don&#x27;t have a public address. With PHP it&#x27;s assumed it will be accessed from the web so if you run it on free shared hosting you get that accessibility built in.<p>PHP is very good for writing services that cost literally nothing because you can run it on free hosts like 000webhost that give you everything you need to host complex services (upload, database, sub-domains, and more.) It&#x27;s perfect for budget devs or maybe devs that want to make their infrastructure more resilient to ah... financial upsets...
评论 #35899811 未加载
jchookabout 2 years ago
PHP 8+ is filling-in a lot of the missing features -- type hints, attributes, named parameters, etc.<p>Nowadays instead of using &#x27;string_you_have_to_remember_and_might_mistype&#x27; or abusing associative arrays as in the given code sample, you can usually get full code completion luxury with PHP without magic comments or other workarounds.<p>PHP 8 is still missing a few critical features such as generics and typed resource handles, and nikic left the project, but I&#x27;m still hopeful PHP 9 will deliver on those key additions.
评论 #35913692 未加载
simonhampabout 2 years ago
If you&#x27;re looking for a great CMS and were bitten by WordPress back in the day, you should take a look at Statamic (<a href="https:&#x2F;&#x2F;statamic.com" rel="nofollow">https:&#x2F;&#x2F;statamic.com</a>)<p>It&#x27;s a Laravel package and it&#x27;s the best CMS I&#x27;ve ever used (from a dev perspective). v4 just dropped the other day
评论 #35899754 未加载
评论 #35900123 未加载
VWWHFSfQabout 2 years ago
That PHP code right there at the very top of the page that is supposed to be representative of how great it is has multiple TOCTOU authorization and validation bugs. In fact, nearly every piece of code on that entire page is riddled with transactional bugs
评论 #35901268 未加载
评论 #35901227 未加载
konartabout 2 years ago
Why would you go with PHP+whateverframework instead of Ruby on Rails or Django?<p>I haven&#x27;t touched PHP since 5th version and I&#x27;m kind of sceptical it can offer anything RoR can&#x27;t.
评论 #35900924 未加载
评论 #35899479 未加载
评论 #35898607 未加载
bityardabout 2 years ago
A great many good things that I still use on a daily basis are written in php. Roundcube and Nextcloud for starters.<p>Some of the most fun I ever had writing basic CRUD apps and simple interactive websites was in PHP and Codeigniter back in the day. I&#x27;m pretty much Team Python now just because of the huge ecosystem but maybe it&#x27;s time to give PHP another chance...
PrimeMcFlyabout 2 years ago
I see no argument at all for using Laravel over Django or Rails.<p>PHP was always a mess. Why would I want to come back to it now on the off chance they don&#x27;t screw things up again?
评论 #35898381 未加载
jszymborskiabout 2 years ago
I used to refresh nettuts.com obsessively in high-school and Jeffrey Way&#x27;s PHP content was the highlight.<p>Sadly the site got a refresh ages ago and is nothing like it used to be.<p>Anyway, if you&#x27;re reading this thread, thanks Jeff!
评论 #35898639 未加载
mongolabout 2 years ago
&gt; It can handle more than 500,000 orders per month when hosted on a $6&#x2F;month server<p>Is this a statement from the real world? What business sells 500,000 orders in a month from a $6 server? I mean, if you sell that much, you would probably want a high-availability solution and they don&#x27;t sell for 6 bucks.
评论 #35900344 未加载
marcus_holmesabout 2 years ago
&gt; It can handle more than 500,000 orders per month<p>Hilarious because other languages are capable of that per minute not per month
评论 #35899234 未加载
评论 #35899189 未加载
评论 #35899201 未加载
评论 #35899426 未加载
lastangrymanabout 2 years ago
There&#x27;s 2 things to separate here:<p>1. PHP the language and developer experience (frameworks, tools, community, docs, etc)<p>2. PHP performance at scale<p>In my experience, PHP is much improved for 1. and fine to work with. Laravel and composer are great.<p>For 2. I would never use PHP on anything above a few hundred requests a second. It&#x27;s slow on its own, but more importantly it&#x27;s blocking IO model will grind things to a halt at any level of concurrency when talking out to database, caches, or other services. You are also vulnerable to issues like saturating your database with connections due the programming model in php-fpm. I know async php exists but my impression is the mainstream frameworks dont support it (I could be wrong?) so why not just switch language at that point. I speak from experience of scaling a Laravel php app up 5k RPS+ and needing a LOT of EC2 instances to do it. Using Go was a revelation and delivered a 10x improvement in terms of resources required to serve the same number of requests.<p>So yes, if your rps &lt; 500, why not, PHP is fine. For anything above that, it&#x27;s a not a great choice.<p>(And defining your scale in terms of orders per month is a bit silly)
评论 #35902107 未加载
e12eabout 2 years ago
I think I&#x27;ll stick with rails if I want cute DSLs and lots of magic (&quot;… broadcast an event to update the frontend in real time …&quot;). But sure, it&#x27;s great that php has come a long way since php3.<p>That aside:<p>&gt; It can handle more than 500,000 orders per month when hosted on a $6&#x2F;month server.<p>Surely it can do more than 700 orders per hour, 1 order every 5 seconds?<p>&gt; The only additional fees are for a CDN (if you want your assets to be served faster) and a domain name<p>Uh, so no managed database, but you recommend paying for a CDN before slapping Varnish in front of your static assets?<p>I get that php might be eminently usable at this point - but this seems like an odd pitch.
thomasfromcdnjsabout 2 years ago
I&#x27;ve been using Laravel for the past year at work, not a hater type but still find it meh even with all the improvements.
fHrabout 2 years ago
I too was a junior that was plagued by wordpress and php custom plugins, never again will I touch this language if I can.
kgeistabout 2 years ago
I agree with the message, but the example has:<p>- hidden global state<p>- arbitrary string literals<p>Is that Laravel?
评论 #35897800 未加载
Tade0about 2 years ago
The other day I finished a side gig I was doing - a Wordpress site recreated using the Wayback Machine - the site went down a while ago and the admin stopped answering phone calls, not to mention emails.<p>It was a largely pleasant experience, taking me back to my early years as a &quot;web developer&quot;. I had to modify some PHP files because the theme used didn&#x27;t offer slots for widgets in places I wanted it to.<p>That being said uncached the site takes over 20 seconds to render. CPU load wasn&#x27;t high so I can&#x27;t help but wonder what was it doing all this time.
评论 #35901279 未加载
mekokaabout 2 years ago
Any programmers here who&#x27;ve used PHP to build command line tools in PHP? What is the experience like compared to, let&#x27;s say Python or node.js? How good are the facilities? What are the limitations?
评论 #35898177 未加载
评论 #35898033 未加载
评论 #35897921 未加载
评论 #35899482 未加载
评论 #35898588 未加载
评论 #35899022 未加载
progxabout 2 years ago
Performance is always a good argument, but, be realistic and be honest, most applications did not need ultra fast performance and most applications did not have hundreds of parallel users.
BulgarianIdiotabout 2 years ago
The problem is this page advertises Laravel, not PHP. Ruby on Rails has many similar &quot;demo worthy&quot; snippets that make complex tasks seem readable and intuitive to the layman. Laravel and Ruby on Rails have something else in common: due to the focus on these &quot;natural&quot; interfaces, they compromise in every other way. Architecture, performance, testability and so on and so on.<p>For those who know PHP, this code is full of singletons masquerading as static classes (which Laravel incorrectly calls &quot;Facades&quot;) which mean no isolation and clear flow of dependencies in your code. In a nutshell, every line of code you write this way comes loaded with a pound of irreducible, unfixable tech debt. Enjoy.
评论 #35900224 未加载
评论 #35899500 未加载
评论 #35905105 未加载
评论 #35899872 未加载
asimjalisabout 2 years ago
There is also Phel (Lisp-like language that compiles to PHP).<p><a href="https:&#x2F;&#x2F;phel-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;phel-lang.org&#x2F;</a>
alex_lavabout 2 years ago
Use pretty much any language. It mostly doesn’t matter.
评论 #35897458 未加载
krylonabout 2 years ago
The last time I used PHP was in 2004 or 2005, PHP was at version 4.something, and I did not like it. That kind of formed my opinion on the language, even though I know it&#x27;s come a long way since. OTOH, I have no reason currently to take another look.<p>But it&#x27;s nice to be reminded, I guess, PHP isn&#x27;t the dumpster fire it was 18 years ago.
cutlerabout 2 years ago
5 seconds per request isn&#x27;t anything to shout about in 2023.
评论 #35900513 未加载
评论 #35909732 未加载
jwithingtonabout 2 years ago
I hosted a phpBB forum as a kid in the early 2000s.<p>15 years later I joined a marketplace startup that was doing 10,000 transactions a day.<p>Built as a PHP monolith.<p>I was sooooo confused at first. “PHP??? That strange language I used to host a forum is powering this app??”<p>Turns out the founding engineer was self-taught and PHP had the most tutorials or something lol
simonhampabout 2 years ago
And come check out NativePHP[1] where you can build native desktop apps using Electron or Tauri + PHP<p>Starting with Laravel support and launching soon<p>[1]: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;search?q=nativephp&amp;src=typed_query" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;search?q=nativephp&amp;src=typed_query</a>
bpbp-mangoabout 2 years ago
Even if you write modern strongly typed PHP and make sure to handle all your exceptions you will still encounter null (and other) errors at runtime. The language is ok these days and far faster than Python &amp; Ruby etc but still I would not choose a new project to use it.
codedokodeabout 2 years ago
I don&#x27;t like that in the code validation rules are applied to a &quot;request&quot; (and written in a controller) but not to a model. This means that if you want to create a model somewhere else, you cannot reuse validation code.
cryptosabout 2 years ago
<p><pre><code> $request-&gt;user()-&gt;orders-&gt;create($request-&gt;validated()); </code></pre> This looks so wrong from an architectural point of view! A request has a user (which in the context of HTTP should be more or less only an authenticated principal), which has orders, which are created from the same request, where the journey started. There is no separation of technical and business concerns.<p>See: <a href="https:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2012&#x2F;08&#x2F;13&#x2F;the-clean-architecture.html" rel="nofollow">https:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2012&#x2F;08&#x2F;13&#x2F;the-clean-a...</a>
评论 #35905083 未加载
MattyRadabout 2 years ago
I actually think this article undersells PHP, as it doesn&#x27;t mention the incredible additions that PHP 8 introduces, nor does it mention excellent static analysis tools like PHPStan.<p>I recently rewrote a PHP web app in Rust (<a href="https:&#x2F;&#x2F;soapstone.mradford.com&#x2F;riir&#x2F;" rel="nofollow">https:&#x2F;&#x2F;soapstone.mradford.com&#x2F;riir&#x2F;</a>) and although it was interesting, I think it would have been better staying a PHP app. As nice as the Rust compiler was, I felt PHPStan would have automatically caught a similar number of bugs, all the while feeling less combative.
pphyschabout 2 years ago
The problem with PHP is not that you can&#x27;t write great maintainable codebases in it -- you certainly can.<p>The problem is how easy it makes it to write obscenely unmaintainable anti-architected code bases in it. <i>The average PHP production code base is deeply offensive</i>. I&#x27;m knee deep in one right now.<p>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.<p>If &quot;PHP&quot; were synonymous with &quot;Laravel&quot;, that would be different. But it&#x27;s not.
timwaaghabout 2 years ago
For me the best platform is one that&#x27;s easy to debug and the debugging story for php is one of the worst. Otherwise it would still be quite hard to read. But at least it&#x27;s cheap to host.
评论 #35900705 未加载
评论 #35900717 未加载
12907835202about 2 years ago
I&#x27;m mostly interested if this is a tiny hobby project by someone who wanted a nice example to use in arguments.<p>Or an advert by someone involved with Laravel&#x2F;Laracasts.<p>As the former it&#x27;s quite effective.<p>The latter would be funny.
devmorabout 2 years ago
There&#x27;s a lot of reasons to both use or not use PHP, but of all the ecosystems I&#x27;ve developed in, PHP has the most lovely dev tooling.<p>Every popular piece of dev tooling in the PHP ecosystem feels like it was made to solve a problem, do so as simply as possible and let you know all the information as cleanly as possible.<p>There&#x27;s contemporaries to most of those tools in every other major language, and all of them have problems or annoyances that I feel simply don&#x27;t exist in PHP&#x27;s tools.
xcombelleabout 2 years ago
I just don&#x27;t get why people in php use lazy comparison when you know that &quot;0e4&quot;==&quot;0e5&quot; in php.<p>and yes, Laravel use lazy comparison (hundreds of times). And yes at least three bugs where caused by this use.<p>see: <a href="https:&#x2F;&#x2F;github.com&#x2F;laravel&#x2F;ideas&#x2F;issues&#x2F;698">https:&#x2F;&#x2F;github.com&#x2F;laravel&#x2F;ideas&#x2F;issues&#x2F;698</a> for why I&#x27;m a bit grumpy with php ecosystem
0xblinqabout 2 years ago
Can anyone with experience in both compare modern PHP and Laravel vs modern Ruby and Rails? Which one would you choose and why, assuming you have the same experience in both?<p>I’m asking because I keep hearing Ruby on Rails is the best for starting a SaaS, etc but from my little experience on it, it seems to me Laravel is way better. Is it just a “language” thing? That most people prefer Ruby to PHP?
krappabout 2 years ago
(sits quietly in the corner wishing Hack had taken off, or at least that one of the things PHP took from it was native XHP.)
jrm4about 2 years ago
Nice. I needed this today. I teach &quot;Advanced&quot; Web Programming and my classes start next week. I&#x27;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.
评论 #35904078 未加载
endorphineabout 2 years ago
Coming from Rails, how does Laravel compares? If you know both languages, which one would you pick? I&#x27;ve this hunch that there&#x27;s no reason to lick Laravel over Rails, since that latter is the bees and knees for web development.<p>Alternatively: what would you suggest someone getting into web development to learn? PHP or Ruby?
评论 #35897879 未加载
评论 #35899877 未加载
评论 #35897707 未加载
评论 #35898600 未加载
minusfabout 2 years ago
what this page means is: go with laravel.<p>wordpress is also php. dont go with php.
simultsopabout 2 years ago
I thought this is a workaround showing off how they use Go lang and PHP together, fell for it!
jrsjabout 2 years ago
PHP is pretty nice these days but salaries for PHP roles are terrible. I can get paid 50% more being half as productive writing Go (for no reason bc 90% of people using it don&#x27;t actually need any of it&#x27;s features or performance)
sourcecodeplzabout 2 years ago
The fact that you can build a whole app inside just one index.php file is highly underrated and I understand how newbies finding this out are getting excited.<p>I remember when Rails first launched and I wanted to try it but it was so complicated to get started.
评论 #35900057 未加载
评论 #35901063 未加载
kmodabout 2 years ago
I always dislike the &quot;requests per month&quot; metric because it seems like a transparent attempt to impress with a larger absolute number: 500k requests&#x2F;month is 5sec per request, which feels pretty underwhelming
评论 #35909705 未加载
throwaway423about 2 years ago
You are touting the language&#x27;s ecosystem or tooling but the language itself is horrid. PHP is carried by Laravel.<p>Another language carried by tooling is Go. The language itself doesn&#x27;t even have sum types, lmao.
marcrosoftabout 2 years ago
No thanks. Those code examples are full of indirection and the bottom example reminds me of the object nested spaghetti mess of large PHP frameworks.<p>Just because code reads well doesn’t mean you can understand easily what it actually does.
评论 #35902627 未加载
iamluzheabout 2 years ago
Replacing PHP&#x2F;Laveral with JAVA&#x2F;SpringBoot is not different at all.
评论 #35900437 未加载
ofrzetaabout 2 years ago
We&#x27;re now at Laravel 10. Take a look at the Laravel Bootcamp for a quick intro <a href="https:&#x2F;&#x2F;bootcamp.laravel.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bootcamp.laravel.com&#x2F;</a>
azangruabout 2 years ago
&gt; Read the following code as if it were a documentation page:<p>If I read this as a documentation page, this makes me scared:<p>`Order::create($validated + [&#x27;status&#x27; =&gt; &#x27;pending&#x27;]);`<p>What does it mean to add an array to something?
评论 #35899306 未加载
评论 #35899166 未加载
评论 #35899100 未加载
评论 #35899107 未加载
lzomediaabout 2 years ago
I mean yeah as a php dev for 12 years since i&#x27;ve started picking up python , i find myself nowdays coding stuff in python :)
ynnivabout 2 years ago
PHP has 99 problems, but shipping code ain&#x27;t one
tinus_hnabout 2 years ago
A major downside of phps model is that there is no continuously running service, so you can’t run timers or background cleanups.
zerrabout 2 years ago
Isn&#x27;t it too much &quot;string oriented&quot;?
SergeAxabout 2 years ago
I see couple singletons calls in those examples. Is it considered a good practice in PHP now, or was it made to simplify the demoed code?
评论 #35900838 未加载
评论 #35900934 未加载
ChrisMarshallNYabout 2 years ago
I’ve been writing PHP for over 20 years. I use it for my hosted (backend) programs.<p>Works a treat. It’s robust, fast as hell, easy to make secure, runs on the cheapest, crappiest hosting, and has an <i>enormous</i> support infrastructure.<p>That said, I’ve never particularly liked the language, and have never become an advanced adept at it. I use it to manage the less-glamorous part of my work. I’m mostly a native Apple developer (Swift).
sberensabout 2 years ago
As someone more familiar with js&#x2F;react, is there an equivalently mature reactive frontend framework?
评论 #35899830 未加载
adamnemecekabout 2 years ago
It&#x27;s one of those posts again. I have no clue what compels people to write things like this.
deafpolygonabout 2 years ago
I have a soft spot for PHP. I love code I can write, then just refresh the page.
JustSomeNobodyabout 2 years ago
Okay, but you didn&#x27;t mention Go at all in the article.<p>Jeffrey Way <i>is</i> a really good teacher, btw.
anonymous344about 2 years ago
of course php is best, but how do u do in app(web app&#x2F;browser) notification with 6$&#x2F;month apache &amp; php? for example if there are 2000 users who need to push a message to when a queue job finishes in php backend?
评论 #35900471 未加载
jensneuseabout 2 years ago
From the title, I thought someone implemented PHP in go. <i>facepalm</i>
BulgarianIdiotabout 2 years ago
Sounds like a threat TBH
openthcabout 2 years ago
In 2001 I started a PHP project and it was cool, lots of people were going that way. In 2008 folk we telling me it&#x27;s a terrible security risk. In 2014 they told me it&#x27;s the WORST choice. In 2023 it&#x27;s cool again?
badrabbitabout 2 years ago
PHP malware on windows is a thing now too lol
danielinoaabout 2 years ago
There is a syntax error in the example shown by that article. If you must use any time to find it then you should not go with PHP.
RadixDLTabout 2 years ago
sorry to break it to you, but symfony is much more superior and flexible than laravel.
1337shadowabout 2 years ago
Still a lot more to type than with Python and especially Django
chrismsimpsonabout 2 years ago
Go where exactly?
phpisatrashabout 2 years ago
The &quot;Good Luck&quot; at end speaks for itself.