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.<p>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) people who just care about hacking something together and, as long as it works, it's fine. They care nothing about elegance and have but a dim conception of larger CS/SE principles.<p>For example, why would you write something in PHP when you've got an excellent choice between Ruby/Rails or Elixir/Phoenix/LiveView, both of which are fantastic, and, especially in the case of the Elixir/Phoenix stack, <i>really</i> developer friendly, easy to set up and deploy, etc. and also have solid foundations?<p>I'm glad to see PHP getting better—it will certainly improve life for those maintaining old PHP projects that are agile enough to upgrade—but I really see no reason to not choose a better tool in this day and age.<p>(You may now call me a troll if you see fit. I stand by what I said though. :-)
It is a great language to put food on the table.<p>Especially in Europe it is still the dominant backend language. If you want to have flexibility on where you work it is a good language to know.<p>You have the productivity of a scripting language but still great static analysis tools that help you out. It really fills a sweet spot that no other language does.<p>Yes, Node has Typescript but then you have a super slow compiler negating the scripting language benefits. With PHP I can change a file and see instant results. Also languages like Go make it hard to debug anything on an live server as it is all compiled.<p>PHP code is mostly boring. The coding style tends to be very pragmatic. Even bad beginner code runs great due to dead code elimination and the like. Shared nothing architecture makes understanding and debugging the system so much easier.<p>Hosting is simple and inexpensive. Beginner can just copy their files to an shared hoster and be done with it.<p>PHP is only a bad choice is you have really complex requirement and need a high level of reliability, which most Web projects don't. I think Haskell fills a good niche here. It is really underestimated. Also Elixir if you happen to build anything where you can play out its strength.
PHP has been in a pretty good place since 7, IMO. These are some great developments.<p>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.<p>It's unfortunate that the stink of old PHP is so powerful and that salaries are still lagging so far behind.
It's nice to see PHP adding useful things like enums and async (green threads). My foray into Web development started with Perl, but quickly segued into PHP with how much simpler it felt. The ability to hop into vim on your server (or use CPanel back in the day) and edit your site live was exciting back then – but now that very thought makes me shudder with what could go wrong, haha.<p>While I've moved onto JVM languages and Rust professionally, I do hope PHP will continue getting future generations excited about Web development and building out their ideas quickly.<p>FYI: Not sure if the author will see this but some spelling mistakes in the article. [0] E.g. s/reslease/release/<p>0. <a href="https://stitcher.io/blog/php-in-2021#the-community" rel="nofollow">https://stitcher.io/blog/php-in-2021#the-community</a>
PHP has astounding longevity. In maintaining my personal websites (static pages, web toys, projects with my writing groups), I always ask myself: how will I keep this running in 20 years?<p>It's unrealistic to think that languages will stay static over 20 years -- servers get rebuilt, old versions languages get deprecated, frameworks disappear. So the question becomes<p>- will I know how to fix or rebuild this, even if I don't touch the code more than once every 5-10 years?
- what is sufficiently resilient to mean that "mean time between rebuilds" is as long as possible?<p>Over all that time, what's lasted best are CGIs (Python/Perl) and PHP, running behind Apache.<p>I don't use PHP day-to-day, so changes in the language don't affect me much. But for keeping the history of the web alive, it is an unparalleled tool, and its proven commitment to longevity is why I still reach for it.<p>Separately: I think that longevity is a question we should ask ourselves more about the web. New ideas often come from experiencing old (even failed) ideas -- but if those old ideas just disappear, we lose some of our ability to progress.
In a post called "PHP in 2021" we really can't omit <a href="https://bref.sh/" rel="nofollow">https://bref.sh/</a> -- it allows running PHP apps on AWS Lambda effortlessly. With all the serverless craze, it's a very important piece of the ecosystem. After writing PHP apps for two decades, I am absolutely stunned how easy it is.<p>Amazon blogged about it at <a href="https://aws.amazon.com/blogs/compute/the-serverless-lamp-stack-part-3-replacing-the-web-server/" rel="nofollow">https://aws.amazon.com/blogs/compute/the-serverless-lamp-sta...</a>
> Still no support for generics, unfortunately<p>Huh? PHP is a dynamic language, you already have them in principle.<p>Usually you can just have no type and use instanceof, but also requiring the parameter to be an interface does the job in most cases if you need more clarity.<p>Edit: There's also method_exists! Also a whole heap of other tools in the toolbox <a href="https://www.php.net/manual/en/ref.classobj.php" rel="nofollow">https://www.php.net/manual/en/ref.classobj.php</a>
When 7.4 was released, with FFI now available, I had the crazy idea to make a cli text editor in PHP[1] (based on kilo[2], and since 8 has come out, with the addition of the PHPToken class, highlighting PHP with PHP has gotten easier.<p>1. <a href="https://git.timshomepage.net/timw4mail/php-kilo" rel="nofollow">https://git.timshomepage.net/timw4mail/php-kilo</a>
2. <a href="https://viewsourcecode.org/snaptoken/kilo/" rel="nofollow">https://viewsourcecode.org/snaptoken/kilo/</a>
As someone who works with Rails and Laravel, one of the huge benefits I find working with PHP/Laravel are the speed and consistency of releases. PHP seems to release versions more frequently, and Laravel tags every week. It means there's much less lead time to work with new features/functionality as it becomes available (when it's stable, rather than running on edge).
My beef with PHP is not so much the language itself, but the weird community that surrounds it.<p>The FIG standard that forbids TAB for indentation (which is perfectly legal in PHP), the notion that classes should be either abstract or final, the micro-optimizations (thou must use single quotes, things like that).<p>I don't think anyone can tell anyone how to write PHP, because nobody knows how to get it right (myself included). Yet in my many years of coding in PHP, there's been more and more tooling and so-called "standards" that do exactly this.
I used to work both with Go and PHP.<p>At first when I started digging into Go I thought that eventually I'll replace platform for all my future PHP projects. But it never happened.<p>Every time I should implement business logic and info exchange with database I immediately became frustrated with so much boilerplate code of Golang. In comparison, writing such code in PHP is real breathe.<p>But suddenly I've got used to Go speed and want to get the same benefits for my PHP APIs. So I've implemented my own framework with low latency and hight throughput in mind. It beats many Go frameworks on TechEmpower Benchmarks! Now I feel like I found epiphany finally :)<p><a href="https://github.com/gotzmann/comet" rel="nofollow">https://github.com/gotzmann/comet</a>
I am not a programmer, and I have hired developers to build websites for me for close to 15 years now.<p>I love PHP. Two reasons. One, because this was the language I learned to code when I started off. So, it's easy for me to understand stuff my developers tell me.<p>More importantly, the language is so mainstream that the developers I work with are quite cheap to hire. The more sophisticated a language is, the fewer the programmers available for hire, which shoots up the costs with no visible changes to me on the front-end.<p>I'm currently building a simple search-engine like project - all on PHP. We have been testing it right now, and it's fast and usable - and I am not regretting my decision to use PHP for this; yet.
I’m primarily a javascript dev who had to dive into php and wordpress this past year for a client.[0] The php docs often drive me nuts with their range of what info and examples are available per feature, and the language’s naming can be funny at times with a lack of consistency...<p>But I really like it. Php writes and reads like javascript. And working with dates has actually been pretty fun - I like the natural language manipulation layer it provides, ie: `last Sunday`, etc. And the built in url parsing.<p>I’m happy to have added it to my tool belt!<p>[0] <a href="https://www.zionbaltimore.org" rel="nofollow">https://www.zionbaltimore.org</a>
I no longer use PHP, but I have to say, I truly appreciate the regular articles on the state of PHP by @brendt_gd. I think they're absolutely awesome, and I wish I could get the same kind of regular rundowns for Python, for example. :)
Daily reminder that by Lindy effects, for each additional year of php still alive the probability of staying alive increase. We will probably die before PHP
I know PHP is really great (and always has been).<p>But sh*t, there is soooo much bad, no, really really bad PHP code that lives out there.<p>Isn't it?