Edit: Jesu X. Chris, I didn’t mean to start a language war. Learn PHP if you want, I won’t stop you lol
Would I use PHP to make games? No! I wouldn’t use JS or Python for that either.
I try to use the best language for the job without letting any cargo cult biases get in the way.
Front end stuff? JS!
Backend stuff? PHP!
AI stuff? Python!
Games and microcontrollers? C/C++!
1. You will still need to learn JS, and now it may even be embedded in PHP depending on the type of app you are working with!
2. It still has horrible conventions, arrays being sorted maps has to be one of the worst design decisions, IMO its worse than having null and undefined as types. Mutlibyte strings are still an afterthought in the core of PHP. Inconsistent function naming. It's new typing system is plain worse than TS in every way. Async programming is still terrible. Needle Haystack swapparoos throughout the language.
3. It was built for the web as it stood 20 years ago, HTML embedded in code, single server sessions, cgi servers, and minimal latency server to server communication. It cannot feel more out of place today.
I will give it: Laravel is a robust framework that helps hide some of this, but its hard to hide most of it.
I'd rather get paid $1,000 to build something that takes < 1 day and $50-150/month to maintain something on a $20 VPS using a tried and true Web technology with tons of developer support and a stable ecosystem.
I can start a new Laravel project and with a starter kit have 50% of the site done. Auth's already done out of the box. The ecosystem is amazing. The tooling is amazing. WordPress is amazing and its ability to extend itself and build almost anything you want is amazing.
I'm moving on to the next client while someone is crying about WordPress' arcane database structure or code and they're still sitting at a text editor with some Haskell code.
All I have to do is worry about my project, not create OCD for 2 weeks on the best way to set something up out of 10 different ways.
I'm not worrying about which flavor of JavaScript framework is in popularity this week - I'm not worrying about how to deploy my Python app and setting up Kubernetes. I'm not worried about compiling my Elixir project to WASM and deploying to Fly.io to support my 1 visitor a month.
Lot of those around[0].
[0] https://w3techs.com/technologies/history_overview/programmin...
Lot of that going around; especially in venues like this, which has a lot of "Ooh! Shiny!" going on. I tend to be a bit more conservative than many; but not to any kind of extreme degree. I like new stuff, but I also like shipping, which doesn't come from the bleeding edge.
Personally, I use PHP on my backend work, mostly because it's a known quantity, and is an industrial-strength, massively-supported system, that is not going anywhere but up.
And I don't feel like learning a whole new language and API, just for some relatively minor-scale server work (I spend most of my time, writing native Swift frontends).
If it's good enough for PornHub, it's good enough for me.
That said, if PHP were, as is often falsely claimed, going away, I'd probably learn something new. I doubt it would be the tip of The Shiny Spear, but it would be a more modern system; maybe Python. I've never actually liked working with PHP, but the same could be said for most languages I've used. I like Swift.
As it is, I would still want to learn Laravel, before moving away from PHP. From what I understand, it's a fantastic framework, that makes PHP a much more effective server system.
I'd take Laravel with Livewire (and some Alpine.js) over Django any-day. Plus my gut feeling says, that React would be as pleasant as Laravel and co.
Snobbery is like saying you're intellectually superior to using a specific screwdriver or kitchen knife.
1. Essentially an HTML document is a valid PHP program. This is an excellent starting point for beginners;
2. PHP has a stateless API that means there's basically zero start up cost, unlike, say, loading libraries like you do in Java or even Python;
3. There's no threading within the context of a request. This is what you want 99.99% of the time. Hack extended this with cooperative async/await;
4. Because of (3) everything you allocate/use within a request context just gets thrown away. There's no persistent state (eg like Java's servlet model). Again, this is almost ideal;
5. Because of all the above, PHP hosting is incredibly cheap and accessible.
The two things I'd probably add to PHP come from Hack: a modern type system with nullable support and the collections (vec, map, set).
Regarding embedded into HTML PHP code - it's a easy for beginners but in a large application it leads to hard to maintain mix of app logic and presentation - AFAIK this feature is rarely used outside toy project for many years.
[1] https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ (very old and some issues may be were addressed but it's hard to fix all of this without creating an incompatible language)
I've always felt that PHP could greatly benefit from a Kotlin-esque interop language with a more modern syntax and QoL upgrades, but I'm not sure if the juice is really worth the squeeze.
I just can't get behind the complexity of build steps and compiling, all just to get a website online. It's crazy. The simplicity that PowerShell (and PHP) bring to this process can't be overlooked... so I like to beat on this drum whenever I get the chance.
Choose the tool that is right for the job, and PHP can be that tool in a surprising number of cases.
I really loved PHP, but now with go+templ (https://templ.guide) I personally don't have a use-case for PHP anymore, but that doesn't mean it's irrelevant for the world.
This is the first time I've heard of Templ. It looks cool and it was really easy to set up. Apparently there are IDE extensions to enable syntax highlighting and HTML auto-completion, but is there a way to type check the templates? One of the things I love about JSX as a templating language is that errors in your markup get reported as type errors [1]. If I write `<a herf="/foo">` instead of `<a href="/foo">` and run `tsc --noEmit --watch`, TypeScript will complain until I fix the issue. You can even extend the types to support your own HTML custom elements. JSX is a first class citizen in TS (and by extension any editor or IDE with support for TS).
[1] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast...
I watched it myself and learned a thing or two despite also working with PHP professionally for years.
Highly recommend to also stop after each video and try to implement a quick example of what it is teaching.