Skip to content

Comment on Choosing PHP in 2022 and beyond

Comments

despite it's terrible APIs it was fast and easy to setup and manage. Speaking from over a decade ago here.. My experience was good with PHP for simple web applications. However any form of concurrency can't easily be achieve with PHP, so that limits the types of applications you can build easily.

Today, you'd be much better off picking up a language that provides concurrency primitives and has tools to build simple pages w/ a request/response flow.

Just my $0.02

any form of concurrency can't easily be [achieved] with PHP

This was true 10 years ago. Not so today - the tools are there, and the frameworks are making it simple to deploy them.

https://twitter.com/aschmelyun/status/1548270721964462081

https://laravel.com/docs/9.x/octane

https://openswoole.com/article/symfony-swoole

But more importantly: the vast majority of apps don't need this. PHP by itself is fast enough for most use cases when set up properly.

From my understanding of how php works it should be "concurrent" by default - each request is handled by web server and then php interpreter is running code in concurrent manner.

There is some shared context that is session for example but how I understand it each request is concurrent anyway.

Is there support for running single script continously?

Your first point assumes that you always run a web application. PHP can be used for general purpose scripting as well. Also even on a Web context how would you support websockets with traditional php? You can how achieve that with swoole.

That's one way to look at it, but there is much better support now for writing code that behaves concurrently within a single web request.

Honestly, I find Laravel to have more activity happening with it than Django.

Only thing I've ever seen that can compare with Laravel is RoR which for whatever reason I've never taken to, but I see the benefits and the story there.

I mean PHP is generally faster than python and has better support for setting up sites quickly (esp in reguards to cost). PHP has a sane package system. I don't know I think you are selling it short.

What kind of concurrency do you have in mind for a web app that can't be addressed by worker/queue set-ups. At least that's what I do in my PHP (and Python) web projects that need concurrency. Laravel has support for a number of backends for managing queues that are written in $not_php [0].

[0] https://laravel.com/docs/9.x/queues

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.