Live data from Hacker News

PHP in 2022

stitcher.io

301–310 of 318 posts

Re: PHP in 2022

#301
post #230

Earlier quoted context omitted.

Quoted post unavailable.

> I've written code that uses ReactPHP, and I can't see why every lib you use needs to be developed for ReactPHP. My guess is that you're an inexperienced dev. Not OP, but perhaps every library is a bit of an overstatement. But, as most PHP code was historically written under the assumption that blocking is fine, potentially any library you use could inadvertently block your event loop.

Thanks for clarifying. That is exactly what I meant.

Re: PHP in 2022

#302

PHP is my go to language for building simple backends that store data as json in a file and synchronize access using flock(...). There are a ton of cheap hosting providers that support PHP and all you have do to is copy your files over and everything works. I love to focus my energy on building a great frontend with React or Vue.

You have any good simple examples of your backend? Sounds like what I've been attempting to explain to others. How many concurrent requests and what size of data can you run with a setup as described?

Because you asked I got around to publishing it on Github: https://github.com/HASMAC-AS/LightStore

Re: PHP in 2022

#303
post #230
post #8

I was a php developer for some time two years ago, before switching to go. I was mainly solving high performance parallel processing and distributed problems. There are things like ReactPHP which are an awesome achievement, but still every lib you use needs to be developed for ReactPHP. After learning about go and goroutines I only find it painful to solve these problems in PHP, even using ReactPHP.

Quoted post unavailable.

Actually you are right, that was my first gig after college, however I actually know of Swoole and researched a bit, but when codebase and tech stack is already given to you by people worshipping their choice you haven't a real handle.

Like written above my statement was meant like: there are people out there, the are so in love with php, that they would (ab)use it for everything. I also know it is my fault to hired with these guys in the first place, however it definitely teached me how to not do things.

Re: PHP in 2022

#304

Earlier quoted context omitted.

> I think that says more about your particular mental model of programming than about programming in general. Well, I originally started programming only using dynamic types. Then I moved to typed languages, and I could avoid whole categories of errors. I don't see it as dogma, I think typed languages are just qualitatively better at creating software. I also think this is starting to become industry experience, as e…

Categorically better for everything and not categorically better for everything you write ? How about for the type of task PHP is often used for? A nearly default CRUD web app w/loads of fields and tables? Rapid prototyping? How about a bunch of simple, standalone interface interactions in JS? The extra grammar won't provide much architectural or conceptual clarity in those super common coding tasks because they're a…

> Categorically better for everything and not categorically better for everything you write?

For everything.

As I mentioned, I started out using dynamically typed languages. I don't agree with your idea that types somehow make it harder to develop things quickly--even the throwaway things.

With types I get to grips with a new API quickly via autodiscoverability, and types provide guard-rails to know I'm using the API properly.

With types, I can avoid whole categories of errors, as even the "simple" things like, for example, processing a CSV file can mess up, when someone has accidentally entered a date instead of an ID and that ends up failing for the user.

It's not dogma to have an opinion that types provide a qualitatively better programming experience all around.

Re: PHP in 2022

#305
post #279

Earlier quoted context omitted.

> I'm curious what is the value proposition of the latest PHP version(s). I think more and more people have started to realise that typed languages make better, more reliable software. The incremental additions to PHP's type system are just a move towards this, I think and can be seen in other languages such as Typescript. I'm just not a fan of dynamically typed languages anymore, even for small scripts. > Why would…

This static-for-everything trend is absurd. Compiling one-off scripts? Give me a break - they're not called scripting languages for nothing.

Types != compilation. PHP provides types but is not compiled.

Re: PHP in 2022

#306

Earlier quoted context omitted.

I started at 16 and I'm 34. Went from working on gaming websites to running giant ERP backends for mobile apps, web apps, and api users in high throughput environments. All I need to get to work is VSCode and some linux VM or container. PHP has an obnoxious amount of depth. You can become an expert on just ORMs or just SSO or just Collections or just routing and still be learning something new everyday. I am actually…

> I am actually "self tought". Whatever that means. What does that mean? I know what taught means, but tought? No idea.

A charitable interpretation would be that he meant "self-taught". It's not that difficult.

Re: PHP in 2022

#307
post #254
post #224

Earlier quoted context omitted.

I meant Docker. The fact that I needed multiple processes (nginx+fpm) made PHP setup tricky compared with e.g. Java with embedded server.

I know what you mean; that has been a problem in the past. In case you have to again, I'd recommend looking into either Roadrunner or Swoole. That makes it possible to have your application run more or less standalone in a single container, hosted by a native application server. This boosts performance incredibly, and exposes a single HTTP port, as it should be. For Symfony: https://github.com/k911/swoole-bundle For…

aha, that looks good. Thanks

Re: PHP in 2022

#308
post #224

Earlier quoted context omitted.

I meant Docker. The fact that I needed multiple processes (nginx+fpm) made PHP setup tricky compared with e.g. Java with embedded server.

> The fact that I needed multiple processes (nginx+fpm) I believe you can have fpm listen on TCP and run nginx in another container if you want, although I haven't tried it so I can't vouch for it.

Yup, tried that. It’s a bit too complex imho but works too.

Re: PHP in 2022

#310

A lot of people here have mentioned Laravel. I think one of the key things about Laravel is that the creator, Taylor Otwell, is only focused on Laravel. Imagine if DHH didn't ever have Basecamp (or 37 Signals) and only focused on Rails and the Rails ecosystem. The Laravel team now has several full time employees working on making the entire Laravel experience as painless as it can be. Of course Taylor and the Laravel…

Rails has people who do it full time as well, AFAIK Shopify workers like Rafael Faranca and I'm sure there are quite a few others. Besides them Rails has an army of volunteer committers, its one of the bigger open source framework communities, and the commit distribution is much healthier than Laravel's: Laravel looks like a one man show compared to Rails. As for all these packages - Ruby has equivalents. It's hard to say what should come included in the framework and how opinionated Rails should be - many people think its already too opinionated.
Post reply on HN