Live data from Hacker News

A look at modern PHP

lwn.net

471–480 of 610 posts

Re: A look at modern PHP

#471
post #399

Laravel is the best REST api framework in existence for any language. Change my mind.

How well are older releases of Laravel supported? I see on their website they are on version 7.x, and have documentation online there also for 6.x, 5.8, 5.7, 5.6, 5.5, 5.4, 5.3, 5.2, 5.1, 5.0, and 4.2. For those with a conservative server software approach who install a Linux distro that will have long term support and then stick with it up until near the end of that long term, and stick with the version of PHP that…

i would probably look at updating and keeping a more secure OS that can run modern software. Asking a framework to maintain a version of their framework for a version of PHP that is no longer supported, is not realistic.

also laravel is open source, if you want to update an old version because you want to run unsupported software, you are welcome to do it yourself also.

Re: A look at modern PHP

#472
post #152
post #81

I've been using PHP professionally since ~1999. I remember ripping the Perl fanboys in the early 2000's until the foundations of PHP started to crumble with what are issues that stick in peoples minds today; so I do wonder if we brought it on ourselves sometimes. But PHP moved on carefully to preserve backwards compatibility. I still have a SaaS first developed back in 2005 on the latest version of PHP that's happily…

> Would I use PHP if I was starting out today? Unlikely, but I know PHP inside out and can wield it to my wicked ends with ease so won't be dropping it anytime soon. So just out of curiosity, if you hypothetically did start learning web development today from scratch, what would you spend time learning instead of PHP?

Piggybacking to say that if you're just starting out, I'd recommend choosing _anything_, as in, your choice of programming language ecosystem is ancillary to learning the broader technologies and patterns common to web applications. Know somebody who knows PHP you can bug? Use PHP. Find the idea of writing Python exciting? Use Python. Really like the tutorial / book you found for Ruby? Use Ruby. It doesn't matter.

Re: A look at modern PHP

#473
post #424

Earlier quoted context omitted.

As someone who's worked heavily in C++/Java and tends toward functional programming approaches I enjoy PHP. There are some features in the language you should avoid, variable-variables being one of the ones that makes logic very difficult to decipher - but C, C++ and Java all have those - and Javascript has the wonderful combination of substr & substring. The useful portions of PHP are extremely powerful, having acce…

Going a bit off-topic, but I can't imagine doing "functional" programming in PHP or Java. C++ has const and top-level functions (PHP kind of does, but the autoloader...). It has (real) generics. It has move semantics, which is great for functional pipelines.

I do functional programming in C# and used to do it in Java at university. C# makes it marginally more pleasant but in general it’s pretty feasible, people will just look at you funny.

Re: A look at modern PHP

#474

Earlier quoted context omitted.

Go and Rust were designed for other things... why wouldn't you compare it to the big language that was actually designed to compete in the same space as PHP? NodeJS. Front end devs are already programming in JS, so there's less adoption cost than PHP. I can't think of a single reason to use PHP over Node (I know both, and have delivered projects in both). The comparison to .Net and Spring makes me think you might be…

Node developer here, but... two notes about your comment concern me a little. 1. "I can't think of a single reason to use PHP over Node" this is fine but can you think of a single reason to use Node over PHP. Is adoption cost the only one? 2. "you might be a bit behind the curve" while the original commenter was talking about PHP being "modern" and dimissing talk of it existing because of legacies, criticising someon…

I can think of a bunch typescript, performance, async

Re: A look at modern PHP

#475

Earlier quoted context omitted.

I'm a PHP "hater", so take this for what it's worth. You are very close to implying that the language doesn't matter if you can hire developers and there are a lot of good packages in the ecosystem. Having worked on several PHP projects (Most being version 7.0+ and zero of them being older than 5.3), the languages is STILL full of gotchas, and it's a huge drag on productivity. I assert that this DOES matter. Even bas…

RE: string -> int, I'm not able to replicate this. https://repl.it/@JadoJodo/SelfreliantEdibleUsers edit: Not trying to discount your feelings overall, but just curious about that specific example.

Most people don't use a production version of php.ini, I'm fairly certain you can turn this off and on in there. I've only run into this on my personal projects (where I don't care too much about the configuration) but never at work.

Re: A look at modern PHP

#476
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

Go and Rust were designed for other things... why wouldn't you compare it to the big language that was actually designed to compete in the same space as PHP? NodeJS. Front end devs are already programming in JS, so there's less adoption cost than PHP. I can't think of a single reason to use PHP over Node (I know both, and have delivered projects in both). The comparison to .Net and Spring makes me think you might be…

I used to use node too, professionally and personally. There's nothing in the Node.js world that matches the vastness of libraries that enable you to be productive as in the PHP world. you surely, can't compare Express.js to Laravel. Node.js security libraries are lacking.

Re: A look at modern PHP

#477

Earlier quoted context omitted.

You don't need to use switches. In fact, I'd argue that if blocks are better if you're evaluating against variable data types. Alternatively, if you really, really want to use a switch statement and loose typing might cause issues, it's pretty easy to compare types before the switch statement, e.g, if(gettype($a) !== "...") { return false; } switch($a) { ... }

Either choice doesn't really look like the sane language anymore

When you have dynamically typed languages, whether to coerce or not is a design decision with usability trade-offs. Javascript exhibits pretty similar behavior with switch statements for exactly the same reason: it also has two types of equality comparisons.

Also, PHP allows you to add explicit type casting to case statements. e.g.,

    case (string) 1:

Re: A look at modern PHP

#478
post #152

Earlier quoted context omitted.

> Would I use PHP if I was starting out today? Unlikely, but I know PHP inside out and can wield it to my wicked ends with ease so won't be dropping it anytime soon. So just out of curiosity, if you hypothetically did start learning web development today from scratch, what would you spend time learning instead of PHP?

Piggybacking to say that if you're just starting out, I'd recommend choosing _anything_, as in, your choice of programming language ecosystem is ancillary to learning the broader technologies and patterns common to web applications. Know somebody who knows PHP you can bug? Use PHP. Find the idea of writing Python exciting? Use Python. Really like the tutorial / book you found for Ruby? Use Ruby. It doesn't matter.

Definitely, learning to solve problems is key.

Re: A look at modern PHP

#479
post #202
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

I really like languages like Rust and Go and they certainly are good languages and I would love to use either on a regular basis as a freelance webdev. But with two recent projects I‘ve worked on neither would be even feasible. In one there was a requirement to generate custom designed PDFs, and in the other I had to implement authentication via SAML. Other language ecosystems that would be feasible in these cases: N…

have you gone through the laravel docs ?

Re: A look at modern PHP

#480
As someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel.

-- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen.

I can literally setup and deploy a laravel application on a horizontally scaled setup with CI & autodeploy within an hour -- while maintaining industry standards.

PHP had its problems -- historically, but so did most languages. Do you remember Javascript before Node/React? Or before jQuery/Prototype? It was _trash_.

The biggest "con" to using PHP is that it's "bad" for the resume, no one is excited about it, so when looking to hire for it, most developers don't feel inspired by it -- which is a serious consideration depending on your circumstance.

Post reply on HN