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.

Moving from Go to PHP Again

404 pointsby rakibtgover 6 years ago

34 comments

trixie_over 6 years ago
Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing.<p>PHP files can be deployed independently, swapped out or updated live.<p>No building&#x2F;compiling of the php files needed.<p>A single layer as opposed to &#x27;modern architecture&#x27; where there&#x27;s client side back&#x2F;front end layers, api layer, logic, validator, data access, and ORM layers.<p>Can extend itself as it runs. For example Wordpress, running off of php files can download plugins to its own server (which are just more php files) to instantly extend itself. Without restarting or redeployment. (What other web platforms can do this?)<p>Intuitive, simple, powerful. Can be as easy as editing a php file in notepad and dropping it on a ftp server. Deployed.<p>Amazon lambda may have more in common with PHP in terms of discreet deployable units of functionality. What&#x27;s old is new again.<p>Compiling&#x2F;deploying an entire system to change a single endpoint feels backwards after using PHP.
评论 #19112166 未加载
评论 #19112840 未加载
评论 #19114811 未加载
评论 #19111933 未加载
评论 #19114619 未加载
评论 #19113350 未加载
评论 #19114136 未加载
评论 #19115013 未加载
评论 #19112037 未加载
评论 #19114160 未加载
评论 #19112528 未加载
评论 #19113787 未加载
评论 #19112802 未加载
评论 #19111853 未加载
评论 #19116999 未加载
评论 #19112470 未加载
评论 #19112650 未加载
评论 #19116549 未加载
评论 #19112188 未加载
评论 #19118254 未加载
评论 #19112312 未加载
tptacekover 6 years ago
For the kinds of applications people tend to build in PHP, PHP is probably a better choice than Go. I&#x27;d still do Django or Rails before PHP, but Go just isn&#x27;t designed to make serverside-rendered database-backed websites especially pleasant to write.
评论 #19111699 未加载
评论 #19111821 未加载
评论 #19111758 未加载
评论 #19112171 未加载
评论 #19111702 未加载
评论 #19115378 未加载
评论 #19123953 未加载
joaodlfover 6 years ago
I love Go, for many situations, but definitely not for a typical user facing website.<p>The community seems bent on the whole &quot;all you need is net&#x2F;http&quot;, but that just isn&#x27;t practical in modern web development. People like ORMs, easy to handle html forms, security as a default, easy session&#x2F;cookie handling etc. In the end, web developers want ease of life.<p>Go is a great language for many things, but if it&#x27;s going to take on the web at large (outside of HTTP APIs), the community needs to grow out of this &quot;net&#x2F;http or nothing&quot; approach.<p>There is some hope, some frameworks like <a href="https:&#x2F;&#x2F;gobuffalo.io&#x2F;en" rel="nofollow">https:&#x2F;&#x2F;gobuffalo.io&#x2F;en</a> are showing up, but the Go ecosystem is dying for a Rails&#x2F;Django solution.
评论 #19113709 未加载
评论 #19114016 未加载
pastaover 6 years ago
I agree with the author. Symfony 4 is the best PHP framework at the moment.<p>Trying both Laravel and Symfony I think there is no need for Laravel (anymore). Laravel just has too much magic that will bite you later on.<p>The only thing you should skip in both frameworks are &#x27;annotations&#x27;. But this is easy to do.
评论 #19112433 未加载
评论 #19112632 未加载
评论 #19113022 未加载
评论 #19113428 未加载
perlgeekover 6 years ago
Wait what, two complete rewrites of their complete website in 2 or 3 years?<p>If you have that much time to spend on rewrites, I really envy you :-)
013aover 6 years ago
Go really just isn&#x27;t designed for the same kind of service that PHP is normally used for. Its best at small API services (and, tangentially, its also pretty great at CLI tools).<p>&gt; They were a little surprised to hear our stack involved Golang and some flat out told us they’d prefer PHP, because that’s what most of our products rely upon.<p>I believe this is the real reason why, and everything else above it is pointless technical justification for a sound business decision. I also believe there&#x27;s an unvoiced, even more powerful reason, in &quot;I already know PHP and don&#x27;t want to learn a whole new thing.&quot;<p>These are both sound reasons. The technical justifications are not.<p>Choosing Go for something like this was a bad decision. But choosing PHP is only slightly better. Opting for Django, Rails, or Phoenix would have better technical justification, but technical justification is rarely the real reason why we make decisions like these.
评论 #19116071 未加载
leetbulbover 6 years ago
Oh man, yes! Doctrine and especially Symfony&#x27;s Form component absolutely spoiled me.<p>Check out Sylius for a really solid Symfony based application: <a href="https:&#x2F;&#x2F;sylius.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;sylius.com&#x2F;</a>
Xeronateover 6 years ago
Why do so many companies keep moving to go? I tried to like it, but it was just so painful to write.
评论 #19112086 未加载
评论 #19111856 未加载
评论 #19120394 未加载
评论 #19113056 未加载
waibelpover 6 years ago
Symfony 4 is much more lightweight than previous versions. If you create a new symfony 4 project with composer you just get an empty project with just a hand full of dependencies. First time I tried out the v4 (coming from 2.x &amp; 3.x) I thought that the installation did not work properly because stuff like twig (for templating) and other things were missing.<p>The whole integration in composer with the symfony flex component makes developing even easier than before: <a href="https:&#x2F;&#x2F;symfony.com&#x2F;doc&#x2F;current&#x2F;setup&#x2F;flex.html" rel="nofollow">https:&#x2F;&#x2F;symfony.com&#x2F;doc&#x2F;current&#x2F;setup&#x2F;flex.html</a>
gigatexalover 6 years ago
Um...<p>“Just for fun, I compared apples and oranges again by benchmarking the login page (which doesn&#x27;t hit any database) for both application versions using Siege.<p>The Symfony application (PHP 7.3, OPcache enabled, optimized autoloader) handles about 1470 req&#x2F;s. The Go application (compiled using Go v1.11) averages about 18600 req&#x2F;s.”
评论 #19113885 未加载
评论 #19114426 未加载
_the_inflatorover 6 years ago
Can relate, after 7+ years I am again using WordPress and PHP again. I am impressed by PHP 7.
评论 #19111803 未加载
moreentropyover 6 years ago
He&#x27;s comparing a language (w&#x2F; extensive standard library) with a web application framework.
评论 #19113681 未加载
评论 #19113379 未加载
throw2016over 6 years ago
PHP is the same but with speed improvements in 7. But even without that the sheer number of high traffic sites built on PHP and proven scalability cannot be ignored or its ease of use and setup.<p>All talk of accessibility and ease for new users often comes off as posturing by some tech folks who then proceed to rubbish any efforts at achieving it and the compromises involved. It fits in nicely with the &#x27;contempt culture&#x27; recently covered here.<p>The growing problem for the technical community and new users is the marketing by other languages, frameworks and those vested in these ecosystems which means using forums like this to belittle, rubbish and exaggerate any perceived fault in everything else. PHP&#x27;s contemporaries like Python, Ruby, Javascript have their many downsides too but these efforts create false binary narratives. This is not a good basis for technical decisions or informed discussion.
评论 #19112956 未加载
iamleppertover 6 years ago
An entire business that resolves around a nag box? Wow!
no_gravityover 6 years ago
It&#x27;s interesting that he names Symfony 4 as one of the main reasons he uses PHP again after he already used PHP with Laravel.<p>I have a lot of discussions with friends in the startup scene about the topic of Laravel vs Symfony. So far it&#x27;s a head to head race.<p>I have yet to find a good &#x27;Laravel vs Symfony&#x27; comparison page. Yes, there are tons of &#x27;SEO optimized articles&#x27; with this title. But I find them all rather uninformative and often even totally wrong and unfair.<p>The page I would love to see would have the same project coded twice. Once with each framework. And then display each file on the left for Laravel and the corresponding file on the right for Symfony.
评论 #19114088 未加载
EZ-Eover 6 years ago
Question : modern PHP is great for websites, but what are the solutions when you need to make some async work ? For example if I need to make few third party API calls in parallel ? With Laravel I resorted to using queues which feels like more complicated than it had to be (each worker takes up quite a bit of memory). Eventually I switched to SQS + Lambda + node.js. Is there any mature way to do async work in PHP ? In Node.js for example, it&#x27;s quite trivial and powerful with promises and async&#x2F;await
评论 #19113892 未加载
评论 #19113876 未加载
评论 #19114624 未加载
tak2sivaover 6 years ago
Golang is not a silver bullet. No programming language is.
ggregoireover 6 years ago
Any idea why PHP has such a bad reputation compared to other interpreted and dynamically-typed languages such as Python?
评论 #19111997 未加载
评论 #19112007 未加载
评论 #19112004 未加载
评论 #19112012 未加载
评论 #19112964 未加载
评论 #19113676 未加载
评论 #19112005 未加载
proyb2over 6 years ago
&gt; Honestly, Go is great. Its simplicity is refreshing and its performance unmatched. I would still pick it if we need a small API or something that requires high throughput.<p>I wonder which part is performance unmatched?<p>My opinion would be Crystal language for its simplicity and higher throughput but unmatched performance is behind Rust and C.
评论 #19111900 未加载
评论 #19115457 未加载
ryanmccullaghover 6 years ago
What IDE do people use for PHP these days? Editing PHP in a standard text editor is a pain because most don&#x27;t supporet &quot;Go to definition&quot;, or &quot;Find all refernences&quot; (Two killer features of Visual Studio)
评论 #19115772 未加载
评论 #19115765 未加载
评论 #19116775 未加载
tmalyover 6 years ago
Internally, I think PHP is great for prototyping. I have written systems in Go and PHP, and I think each has their strengths.<p>I like the batteries included standard library and single binary deployment of Go.<p>PHP, like others have said, gives you a single endpoint and you can make rapid changes. Its ideal for internal web apps that do not require insane performance.
thrownaway954over 6 years ago
In all seriousness... doees PHP have C# envy? With all of the stuff that has been put into PHP7 (like typed returns and typed arguments) and stuff being proposed (like annotations), PHP isn&#x27;t that far off from being a interpreted brother of C#.
评论 #19113988 未加载
评论 #19113947 未加载
luordover 6 years ago
Now that&#x27;s pragmatism that&#x27;s rare to see, specially here in HN.
bsaulover 6 years ago
Honest question : is there any technical reason that prevents a go web framework to replicate the functionalities of symfony &#x2F; doctrine ?
评论 #19112726 未加载
argd678over 6 years ago
Is there any way to test php code the same way a compile phase does in other languages to catch obvious mistakes from hitting your users?
评论 #19115731 未加载
评论 #19111991 未加载
评论 #19111936 未加载
ilovecachingover 6 years ago
Why not try out Hack? It&#x27;s kind of a cross between PHP and Go. Hack has a real type system, and HHVM is incredibly fast.
评论 #19111908 未加载
评论 #19112034 未加载
评论 #19113998 未加载
kenzieLover 6 years ago
I stopped working with PHP about 4 years ago and I can&#x27;t say I miss it. I moved to Python and never looked back.
lazyantover 6 years ago
Seems like he didn&#x27;t go from Go to PHP but from Go to a PHP framework that does a lot of things for him.
abbiyaover 6 years ago
Would you choose golang if we have a framework like symfony in Go?
aboutrubyover 6 years ago
Seems like he should try Rails (from which Symfony was inspired) and that is much better suited for building web apps that Go
评论 #19114114 未加载
Bucephalus355over 6 years ago
[deleted]
评论 #19111928 未加载
评论 #19111875 未加载
the_other_guyover 6 years ago
Golang is awesome once you submit and accept its intentionally mediocre design as a work of mysteriously genius simplicity. I did that myself and now I love it.
crimsonalucardover 6 years ago
I&#x27;m finding that although golang offers type safety it introduces a new kind of error class to applications typically not encountered in web apps of the python&#x2F;php&#x2F;ruby&#x2F;node class.<p>Deadlocks and race conditions.<p>For node, the entire app is a single thread so this just doesn&#x27;t happen. For python&#x2F;php&#x2F;ruby concurrency is abstracted away and handled above the framework layer so the programmer never has to deal with it. You can launch threads in a route handler for these languages but it&#x27;s not often done and you have nothing like a context object that is basically this abstraction leak that explicitly forces the programmer to constantly be aware of concurrency issues.
sandreasover 6 years ago
Well comparing Go and PHP is kind of difficult, because they are targeting completely different goals.<p>After some years of development, both languages have evolved a lot and they both can be used for many other things, that they haven&#x27;t been designed for.<p>PHP was a dynamically typed scripting language to build personal homepages (Personal Home Page Tools). Today it is an object oriented, type hinted language that supports functional and object oriented programming, many database management systems and has a package manager (composer). I really like PHP (see <a href="https:&#x2F;&#x2F;github.com&#x2F;sandreas&#x2F;m4b-tool" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sandreas&#x2F;m4b-tool</a> for a proof), but some concerns about PHP have always been (and still are):<p>- backwards compatibility reaching too far<p>- way too big standard library (see levenshtein function)<p>- the &quot;callable&quot; concept - call_user_func_array([$obj, &quot;method&quot;])<p>- mixing up too many concepts (OOP, Traits, Functional style)<p>- the type system (which is getting better with php 7)<p>- unpredictable statements - empty($x), comparisons (== vs ===) and the &quot;mixed&quot; type<p>- the &quot;array&quot; type being array and dictionary and...<p>- the $ used for variable declaration<p>- $this-&gt; is still needed for calling object methods<p>- &quot;.&quot; for concatenation and &quot;\&quot; for namespace separation<p>Another bad thing about PHP is, that on most web servers it is meant to be stateless, which means that you are in trouble using technologies like websockets.<p>Some of these things unfortunately mean that PHP often is much slower than it could be - and this is where &quot;go&quot; can be a successor. Performance. If you really need FAST web apps and performance is the goal, go can be a nice choice. But for getting things done in a not too complex web page, i would always choose php.
评论 #19112815 未加载
评论 #19115030 未加载