PHP in 2022(stitcher.io)
stitcher.io
PHP in 2022
https://stitcher.io/blog/php-in-2022
306 コメント
I learned to use php when I was like 14. I’m 27 now and still derive such joy when making my own little projects that will never see the light of day. I try to be humble as far as just being a php trash coder, but I don’t feel too ashamed honestly, as it is the most mainstream thing really. I will always be grateful to php for being accessible and yeah, I guess easy. I don’t know why php is the only one I really stuck with exactly, but it is weirdly dear to me. Nearly half my life I’ve never gone too far past being a lowly php coder, and not a great one at that, but I still like what I can make at the end of the day. It’s a side creative thing for me. Laravel was a revelation for me over the last few years, it just makes some things make sense that never did for me as a self-taught hobbyist.
I'm just leaving my current role, a fast growing start up with a completely custom framework. Currently at half a million active accounts but there's really no bottleneck with the PHP. Can easily keep throwing more boxes and hardware at it and I feel pretty comfy that it will be fine at 20 million active accounts. Also background jobs processing which is sort of async cause it lives on top of SQS and fires a sub process for every new message.
My iteration cycle is very fast. No need to sit there and wait for compiles. PHP is C-like and written in C so the hate is funny to me. Our code is unit tested, documented, and extremely well organized. I even connect to our database on my dev box through an SSH tunnel managed by a tool I made for us in.... PHP which uses AWS IAM to authorize a private key for 60 seconds and then auto connect. That's how I connect to our EC2 instances too.
I'm now jumping to another successful start up with a small team running Laravel. Again super organized and well documented.
My iteration cycle is very fast. No need to sit there and wait for compiles. PHP is C-like and written in C so the hate is funny to me. Our code is unit tested, documented, and extremely well organized. I even connect to our database on my dev box through an SSH tunnel managed by a tool I made for us in.... PHP which uses AWS IAM to authorize a private key for 60 seconds and then auto connect. That's how I connect to our EC2 instances too.
I'm now jumping to another successful start up with a small team running Laravel. Again super organized and well documented.
I'm glad the community around modern PHP is thriving, but filler articles like these are getting on my nerves. Reiterating a bunch of content that has already been covered extensively on the web in the past months (and in 10+ previous posts on your own blog), slapping a misleading title on it and filling it up with call-to-action's for your own personal video/newsletter/courses isn't good content. The author had some really good articles in the past, but this reads like fluff just to fill up his blog. Quality over quantity.
I started my career in PHP ~15 years ago trying to do OOP in PHP 4.x. That was "fun".
In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level.
I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and some of the frameworks were trying too hard to copy the Java ecosystem, all while Java itself was starting to modernize.
I'm curious what is the value proposition of the latest PHP version(s). Why would I choose PHP when starting a greenfield project? I know one of the easiest answers is that there's a huge amount of developers worldwide that know PHP, but apart from this obvious reason is there anything else that would make someone choose PHP ahead of other stacks?
In the meantime I switched to other stacks but I've been keeping a distant eye on how PHP was evolving and I still am involved with PHP projects to a certain degree, though rarely at code level.
I really appreciate the effort put into fixing most of the things I hated about the language, though at times it felt like the language and some of the frameworks were trying too hard to copy the Java ecosystem, all while Java itself was starting to modernize.
I'm curious what is the value proposition of the latest PHP version(s). Why would I choose PHP when starting a greenfield project? I know one of the easiest answers is that there's a huge amount of developers worldwide that know PHP, but apart from this obvious reason is there anything else that would make someone choose PHP ahead of other stacks?
Is it just me or PHP's evolution is a bit "too little, too late" for an almost 30-years old language?
PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course.
That, and also the fact that it may be pretty much the only dynamic language in use today with ARC and not a GC. Funny how PHP devs are often unaware of this.
Anyway I wish the language at least evolved faster and we wouldn't wait for 8.0 to have global `const` definitions instead of the archaic `define()` for example.
PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course.
That, and also the fact that it may be pretty much the only dynamic language in use today with ARC and not a GC. Funny how PHP devs are often unaware of this.
Anyway I wish the language at least evolved faster and we wouldn't wait for 8.0 to have global `const` definitions instead of the archaic `define()` for example.
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.
I love to focus my energy on building a great frontend with React or Vue.
I'm a fan of PHP and have been for years for several reasons:
1. Low barrier to entry;
2. Hard to leak resources since the model is to tear down everything after a request finishes;
3. Stateless API core which means the efforts of creating an environment for a request for (2) is extremely low. Compare this to, say, the bootstrap time for Python or Java (which is why those generally don't follow the request teardown model);
4. Almost no multithreading.
This makes it great for servicing HTTP requests IMHO.
I need to compare it to Hack/HHVM though since I used that for years and it's still playing catch up with features Hack has had for years eg:
1. Hack has had the async-await model for years;
2. The type system is actually really good. It made me appreciate how nullability being part of the type system is incredibly useful. Plus it's had generics for years; and
3. Better inbuilt collection types with less odd coercion behaviour (ie dict, keyset, vec).
I find PHP hate in 2022 to be tired. Look at something like Laravel and PHP is completely fine. The sins of the past and even the odd inconsistencies still left in the language (eg needle and haystack param ordering) don't really matter.
1. Low barrier to entry;
2. Hard to leak resources since the model is to tear down everything after a request finishes;
3. Stateless API core which means the efforts of creating an environment for a request for (2) is extremely low. Compare this to, say, the bootstrap time for Python or Java (which is why those generally don't follow the request teardown model);
4. Almost no multithreading.
This makes it great for servicing HTTP requests IMHO.
I need to compare it to Hack/HHVM though since I used that for years and it's still playing catch up with features Hack has had for years eg:
1. Hack has had the async-await model for years;
2. The type system is actually really good. It made me appreciate how nullability being part of the type system is incredibly useful. Plus it's had generics for years; and
3. Better inbuilt collection types with less odd coercion behaviour (ie dict, keyset, vec).
I find PHP hate in 2022 to be tired. Look at something like Laravel and PHP is completely fine. The sins of the past and even the odd inconsistencies still left in the language (eg needle and haystack param ordering) don't really matter.
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.
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.
I use PHP for my backend work. I don't claim to be an expert, but I have been writing in it for over 20 years. I probably started by rewriting PHP-Nuke to emit actually valid XHTML (what a chore -never again). I've written a couple of CMSes in it, and many plugins.
I've done some fairly big stuff, in PHP.
Works a treat. Fast, solid, secure. Widely-supported, great way to have a high "bus factor," because so many people can understand it.
All that said, I never did really like the language. It has always been a necessary evil, for me.
I've done some fairly big stuff, in PHP.
Works a treat. Fast, solid, secure. Widely-supported, great way to have a high "bus factor," because so many people can understand it.
All that said, I never did really like the language. It has always been a necessary evil, for me.
if you are working on PHP projects - dont forget to look into swoole/openswoole. all major PHP frameworks are adopting it now.
this way you can do async and build websocket servers and such and build http applications with event loop and without apache/nginx and such. etc etc
this way you can do async and build websocket servers and such and build http applications with event loop and without apache/nginx and such. etc etc
It's still a language that's mainly used for web development, right?
Modern websites in big companies require pretty complex backends that require data processing queues and other background activities. Can PHP compete with languages such as Go, Python or Ruby in the future?
Modern websites in big companies require pretty complex backends that require data processing queues and other background activities. Can PHP compete with languages such as Go, Python or Ruby in the future?
Syntax sugar is nice. It helps PHP sidestep the age-old criticism about its crappy API, although the crappy API is still there if you want to use it.
What's really great about PHP these days is the development environment. Composer is a rock-solid package manager. Most frameworks and important libraries are gravitating toward shared standards defined by PSRs. Thanks to those shared standards, the APIs are stable and easy to understand. There's no colors/faker/left-pad drama. Everything just works out of the box and keeps on working. Everything is extensively documented. And somehow the runtime keeps getting faster without breaking backward compatibility.
What's really great about PHP these days is the development environment. Composer is a rock-solid package manager. Most frameworks and important libraries are gravitating toward shared standards defined by PSRs. Thanks to those shared standards, the APIs are stable and easy to understand. There's no colors/faker/left-pad drama. Everything just works out of the box and keeps on working. Everything is extensively documented. And somehow the runtime keeps getting faster without breaking backward compatibility.
Won’t be long before php is java
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 team have paid products, but they are all 100% focused on the Laravel ecosystem and developer experience!
Some of the things that the Laravel ecosystem has as first party packages / services:
Paid:
• Vapor - Serverless Platform. Run your vanilla Laravel apps on Lambda.
• Forge - Server Management. Builds Laravel ready servers on any cloud.
• Envoyer - Zero Downtime Deployment. Deploy your apps with push-to-deploy.
• Nova - Administration Panel. Completely code-driven admin panels.
• Spark - SaaS App Scaffolding. Basically a SaaS starter kit.
Free:
• Horizon - Queue Monitoring. Like Sidekiq
• Jetstream - App Scaffolding. SaaS starter kit with teams, invitations, api, etc.
• Echo - Realtime Events. Think Pusher, Socket.io, etc.
• Sail - Local Docker environment.
• Valet - Dev Environment for Macs.
• Mix - Webpack Asset Compilation. A sane wrapper around webpack.
• Cashier - Subscription Billing Integration. Stripe + Paddle.
• Dusk - Browser Testing and Automation. First party browser automation for tests.
• Sanctum - API / Mobile Authentication.
• Laravel Scout - Full-Text Search. Wrapper around Algolia, Melisearch, or full-text database searching
• Socialite - OAuth Authentication. Log in with GitHub, Google, etc. Dozens of community packages as well.
• Telescope - Debug Assistant.
That's all first party. It's unbelievable to me how many batteries are included. Then you start looking at the surrounding ecosystem beyond that and it gets even crazier.
Laravel as a community is an extremely welcoming place, and I have found that most people care deeply about their code and architecture, but don't pick each other to death on details that don't matter. I think all in all it's a pretty pragmatic group.
If you haven't checked out PHP lately because you think we're writing a file-per-page and FTPing them up somewhere, you should give Laravel a look.
Of course Taylor and the Laravel team have paid products, but they are all 100% focused on the Laravel ecosystem and developer experience!
Some of the things that the Laravel ecosystem has as first party packages / services:
Paid:
• Vapor - Serverless Platform. Run your vanilla Laravel apps on Lambda.
• Forge - Server Management. Builds Laravel ready servers on any cloud.
• Envoyer - Zero Downtime Deployment. Deploy your apps with push-to-deploy.
• Nova - Administration Panel. Completely code-driven admin panels.
• Spark - SaaS App Scaffolding. Basically a SaaS starter kit.
Free:
• Horizon - Queue Monitoring. Like Sidekiq
• Jetstream - App Scaffolding. SaaS starter kit with teams, invitations, api, etc.
• Echo - Realtime Events. Think Pusher, Socket.io, etc.
• Sail - Local Docker environment.
• Valet - Dev Environment for Macs.
• Mix - Webpack Asset Compilation. A sane wrapper around webpack.
• Cashier - Subscription Billing Integration. Stripe + Paddle.
• Dusk - Browser Testing and Automation. First party browser automation for tests.
• Sanctum - API / Mobile Authentication.
• Laravel Scout - Full-Text Search. Wrapper around Algolia, Melisearch, or full-text database searching
• Socialite - OAuth Authentication. Log in with GitHub, Google, etc. Dozens of community packages as well.
• Telescope - Debug Assistant.
That's all first party. It's unbelievable to me how many batteries are included. Then you start looking at the surrounding ecosystem beyond that and it gets even crazier.
Laravel as a community is an extremely welcoming place, and I have found that most people care deeply about their code and architecture, but don't pick each other to death on details that don't matter. I think all in all it's a pretty pragmatic group.
If you haven't checked out PHP lately because you think we're writing a file-per-page and FTPing them up somewhere, you should give Laravel a look.
Wow, Php almost catches up with majority of programming languages!
PHP was a pretty cool language back in the days. Bizarre (yet fast) stdlib and ugly syntax, but super quick to write web stuff, supported by every shared hosting.
Nowadays, it seems to mimic Java, while having inferior libraries, I'm not sure what's the advantage.
Nowadays, it seems to mimic Java, while having inferior libraries, I'm not sure what's the advantage.
PHP in 2022 has much going for it, the only dark clouds on the horizon is the increasing framework oligarchy within the PHP community, which may reduce innovation and foster a "one size fits all" culture.
Maybe I am just too old and tired, but current PHP has nothing to do with original PHP, version by version it changed direction and the last versions are just yak shaving.
I strongly believe that a programming language should be stable over a longer period of time while bug fixes and behind the scene improvements are fine, but for the developer it should not be a moving target, the manual should not triple in size and developers that know very well version x-1 should have zero problems with version x. There is a huge cost of change and if some people don't care, real life does.
I strongly believe that a programming language should be stable over a longer period of time while bug fixes and behind the scene improvements are fine, but for the developer it should not be a moving target, the manual should not triple in size and developers that know very well version x-1 should have zero problems with version x. There is a huge cost of change and if some people don't care, real life does.
I have worked with many programming languages and what attracts me to PHP the most is the simplicity of its tooling.
Javascript is what PHP should be since day 1.
As long as wordpress still holds 40% of the sites PHP will be a major language.
In my opinion, all the modern 'script' languages are now adding static-typing one way or another, to make they much robust(python's mypy, typescript,PHP, etc).
I will pick PHP for backend website development, I just want to avoid the async-node-js as much as I can as it's much worse than other options I feel.
In my opinion, all the modern 'script' languages are now adding static-typing one way or another, to make they much robust(python's mypy, typescript,PHP, etc).
I will pick PHP for backend website development, I just want to avoid the async-node-js as much as I can as it's much worse than other options I feel.
Cool to see it's still kicking and making major improvements
enums in PHP! I've been waiting a long time for this
I havent used pho for 10+ years now, but the point is - the tools mostly don't matter. What matters is the result.
Enums with functions. WTF
>>Packagist, now with over 3 million registered versions and more than 300.000 packages
I see PHP continues to import all of the problem of npm into the PHP community, I moved away from php about the time packagist started to gain ground.
I see PHP continues to import all of the problem of npm into the PHP community, I moved away from php about the time packagist started to gain ground.
Hating on PHP almost feels like racism. All the arguments are biased or false. I always get sad after clicking on PHP articles on HN.