Live data from Hacker News

PHP in 2021

stitcher.io

261–270 of 309 posts

Re: PHP in 2021

#261
post #241

Earlier quoted context omitted.

>With PHP you have more moving parts, Apache/Nginx with their configuration and then the PHP script. With golang/rust/python/nodejs you have direct access to the webserver and more control, but the same simplicity. From my limited node experience I had to setup Nginx too and then connect it with node, and setup some manager like "pm" to keep the things running. When people say PHP is simple to setup they mean the cus…

The OP I responded to was about having a quick script up and running. Of course for a fully fledged app you might have a reverse proxy or similar. Also PM is just a simple hypervisor, it doesn't have any logic, while Apache and Nginx do.

php -S

if you want a quick script up and running

Re: PHP in 2021

#262
post #68

PHP has been in a pretty good place since 7, IMO. These are some great developments. I would say that Laravel is an extremely high quality framework (on par with and even in some ways better than Rails) that nobody should be ashamed to use. It's unfortunate that the stink of old PHP is so powerful and that salaries are still lagging so far behind.

That's because the "stink of old PHP" never really went away. For example, Wordpress install guide [0] still talks about making your code directory writtable by web user -- practically guaranteed that any minute exploit will lead to permanent web shell. So does Nextcloud install guide [1]. I am sure there are nice, modernPHP somewhere, but a lot of time you I see old-style programs with horrible security practices. […

The list goes on, I have a pet peeve with matomo (aka piwik) for example. Impossible to do immutable containers --- it's just bad software design, not a fault of the language itself. But because these softwares are old and have an user base, design errors remain throughout decades.

Re: PHP in 2021

#263

Earlier quoted context omitted.

Non technical people won't use Docker, it's too complicated. Unless you make some environment as easy and widespread as your typical CPANEL shared hosting, you won't compete with PHP for that kind of end-user.

But isn't all cloud offerings basically a better cpanel with docker or kube or whatever? Don't get me wrong, as a developer I hate the bloat, but as a UX/UI PoV you can install a lot of shit that's dockerized pretty easily... sandstorm.io is a cool way to self-host open source projects for example

Can I download your non-PHP app, copy and paste into a folder, and get it running after 5 clicks? More important, are the majority of apps of non PHP langs like this?

Most PHP apps out there are dump easy to use. That's not the case even for Python.

Re: PHP in 2021

#264
post #64

Earlier quoted context omitted.

> Why do I need Docker to play around with a web framework? PHP is server side, not frontend like React or Angular

I think OP was referring to Laravel as the web framework, not PHP.

Maybe but I would find even that is more confusing.

Re: PHP in 2021

#265

Earlier quoted context omitted.

>> Go's development workflow is a lot worse than PHP. I beg to differ. - Runtime errors are more common in PHP and that's a good enough reason for me to say that PHP dev workflow is worse. - You also seem to miss some common errors when the PHP assets are missing. Suddenly the compile con becomes an advantage for Go. - Different servers (apache, nginx, etc) give you yet another thing to configure. From my very old pa…

> - Runtime errors are more common in PHP and that's a good enough reason for me to say that PHP dev workflow is worse. Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform > - You also seem to miss some common errors when the PHP assets are missing. Suddenly the compile con become…

> Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform

A type system reduces the risk of runtime errors, because it doesn't let you write code with undefined behaviour such as indexing a null. Depending on the implementation, it can even force you to handle all possible failures explicitly so that execution always completes. With languages such as rust or Haskell it's feasible to write complex code with almost complete confidence it won't hit any runtime errors, excluding resource exhaustion or machine failure of course.

On the other hand you could argue that logic errors depend on the skill of the programmer and not the language.

Re: PHP in 2021

#266

Before you call me a troll, know that I worked with PHP for two+ years maintaining both legacy codebases and writing new code with Laravel. My question is: why would anyone want to start something new with PHP in 2021? Is there anything that it does better than any other language/ecosystem? I feel like the community is full of (but not exclusively composed of—there are some gems like Caleb Porzio who write good stuff…

Wordpress. I haven’t been paying attention for a few years, but last I looked wordpress powered over half of public websites. Wordpress was forced upon my team at my last job because non technical users have been exposed to it and training costs were a big deal for my organization. It wasn’t something I would have preferred for technical reasons but it just sort of makes sense in a lot of contexts where a content management system is required.

Re: PHP in 2021

#267

Earlier quoted context omitted.

Nest.js is more like Angular

I think you're thinking of Next/Nuxt. I'm a laravel dev but have tried every framework under the sun cause I get bored. Next/Nuxt are basically react/vue SSR / Server Side Rendering or SPA frameworks... which seems more like Angular..no? Nest.js is a fullstack backend framework more like fastify or express and has guides on connecting databases, graphql, etc.... Personally, if I were going to go with node, I'd choose…

The last sentence in their philosophy section reads " The architecture is heavily inspired by Angular." https://docs.nestjs.com/#philosophy

Re: PHP in 2021

#268

Earlier quoted context omitted.

> - Runtime errors are more common in PHP and that's a good enough reason for me to say that PHP dev workflow is worse. Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform > - You also seem to miss some common errors when the PHP assets are missing. Suddenly the compile con become…

> Seems you just know more Go than PHP, which is fine of course. No language has "more runtime errors" than other languages, just developers of varying skill-levels in that particular platform A type system reduces the risk of runtime errors, because it doesn't let you write code with undefined behaviour such as indexing a null. Depending on the implementation, it can even force you to handle all possible failures ex…

FYI you can get a lot of this checks in PHP too if you annotate your code. It is built in in the IDEs too so there is no extra work for you. Sure you can make errors but I do it for productivity reasons, I can perform refactoring like "Rename", "Find Usage" in PHP exactly as in Java, it is much pleasant then the situation on front end.

Re: PHP in 2021

#269
post #62

Earlier quoted context omitted.

This is very surprising to me honestly. Yeah, folks have pointed out some of the big players, but none of them have really risen above the competition. You would think NodeJS would have a clear cut dominant, monolithic web framework by now but there isn’t. Everyone seems to be happy to throw together hodge-podge Express apps.

That is because everyone is writing SPAs with node and thus only needs an api like express for the backend stuff.

Even for writing APIs a monolithic web framework can be useful.

We're building a Django + React web app, and Django brings many things to the table, for example the admin panel, an opinionated structure, and many other goodies. Much better dev experience than just Express for a small team, IMO.

Re: PHP in 2021

#270

Earlier quoted context omitted.

There are many reasons to use PHP: - you have already a dev team that are good PHP developers, it is stupid to switch to Python or Ruby , you lose their experience and any chance of reusing existing PHp code you have. The dev team probably knows JS so node might be an option. - maybe you want to build something super simple, like some third party needs to send you a notification event and you want to record that even…

> You can do this with one PHP file , one a super cheap hosting , with code that is simple and clear. This. PHP is basically Functions-as-a-Service over commoditized virtual hosting. Maybe we need a toolchain that can transpile down to PHP, starting from more common languages with better development workflow.

Haxe does this https://haxe.org/

Is it a better language with better workflow? Maybe. But I do know there are people using it in just this way.

Post reply on HN