Live data from Hacker News

Moving from Go to PHP Again

dannyvankooten.com

181–190 of 371 posts

Re: Moving from Go to PHP Again

#181
post #68

I agree with the author. Symfony 4 is the best PHP framework at the moment. 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. The only thing you should skip in both frameworks are 'annotations'. But this is easy to do.

You are 100% right about that. I've nearly tried almost all PHP frameworks, quite extensively I may add and at the end of the day I found that the less framework I use the better and faster my dev is. Now I just use packages from composer as needed and never ever use them anymore. For me Laravel was a nightmare to use with Vue. Both template engines (blade, vue) use moustache tags so everything has to be declared ins…

Interesting. Coding without a framework is rare these days. I would like to hear more about how you do the basic infrastructure stuff usually provided by a framework:

Routing

Templating

DB abstraction

Re: Moving from Go to PHP Again

#182
post #13

Each PHP file is an endpoint. As opposed to having routers in code or client side SPA routing. PHP files can be deployed independently, swapped out or updated live. No building/compiling of the php files needed. A single layer as opposed to 'modern architecture' where there's client side back/front end layers, api layer, logic, validator, data access, and ORM layers. Can extend itself as it runs. For example Wordpres…

Wordpress can instantly extend itself and its extensions can instantly self-f*ck the whole thing up. (Sorry for the WP hate, I forgot to take my pills)

Re: Moving from Go to PHP Again

#183

Earlier quoted context omitted.

In go, Querying SQL is very much like doing the same thing with the base libraries for mysql in C. Doing the same in most any other language is much much easier and just as safe. Credentials: Worked mainly in go for 4 years... 18+ years coding in about 9 languages. Yes I realized this is opinion.

Huh? How is database handling different in Go? You write a parametrized query, the driver prepares it and you deal with the response. MySQLd in PHP is a mirror process, and in fact retains the C function names.

I think the parent refers to lack of automated result to struct mappers, or maybe lack of decent orm... although it’s probably lacking not due to go features, it’s just that kind of magic is typically not the go way.

Re: Moving from Go to PHP Again

#184

Earlier quoted context omitted.

Flask is a good alternative to Django for building web apps with python on the backend. If I'm using react or vue with a JSON API, I don't need the form support in symfony or django.

However, deploying a Flask/Django/Rails app still is usually less fun than deploying a PHP app of the same spec written w/ Symfony or Laravel. Configuring a service to monitor gunicorn, which itself took a bit to configure, before I begin configuring NGINX or Apache... it's really a pain in the butt. LAMP/LEMP stacks just... are

I'm working on an internal tool for our micro operation (we're 2 folks) built with Flask and it was my main concern.

Turns out, leveraging Dokku and having the right files, ie a Procfile to bind your app to Gunicorn and pushing the repo to the dokku instance was all it took.

Granted, it's for internal use so downtime isn't that big of an issue.

Re: Moving from Go to PHP Again

#185
It's interesting that he names Symfony 4 as one of the main reasons he uses PHP again after he already used PHP with Laravel.

I have a lot of discussions with friends in the startup scene about the topic of Laravel vs Symfony. So far it's a head to head race.

I have yet to find a good 'Laravel vs Symfony' comparison page. Yes, there are tons of 'SEO optimized articles' with this title. But I find them all rather uninformative and often even totally wrong and unfair.

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.

Re: Moving from Go to PHP Again

#186
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't that far off from being a interpreted brother of C#.

Re: Moving from Go to PHP Again

#187
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's quite trivial and powerful with promises and async/await

Re: Moving from Go to PHP Again

#188
post #187

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

One easy way to do multiple http requests in parallel are the curl_muli functions:

http://php.net/manual/en/function.curl-multi-init.php

Re: Moving from Go to PHP Again

#189
Um...

“Just for fun, I compared apples and oranges again by benchmarking the login page (which doesn't hit any database) for both application versions using Siege.

The Symfony application (PHP 7.3, OPcache enabled, optimized autoloader) handles about 1470 req/s. The Go application (compiled using Go v1.11) averages about 18600 req/s.”

Re: Moving from Go to PHP Again

#190

Um... “Just for fun, I compared apples and oranges again by benchmarking the login page (which doesn't hit any database) for both application versions using Siege. The Symfony application (PHP 7.3, OPcache enabled, optimized autoloader) handles about 1470 req/s. The Go application (compiled using Go v1.11) averages about 18600 req/s.”

I’d say that’s apples v apples.
Post reply on HN