From PHP 5.6 to PHP 8.2
HTML-код
- Опубликовано: 10 окт 2023
- This is the "From PHP 5.6 to PHP 8.2" segment from my "What's new in PHP 8.3 " livestream. Watch the full livestream here: ruclips.net/user/liveWUz19fb5zgw.
----------------------------------------------------------------------------------------------------
- Twitter: / enunomaduro
- Threads: www.threads.net/@enunomaduro
- Mastodon: mastodon.social/@nunomaduro
- LinkedIn: / nunomaduro
- RUclips: / nunomaduro
- GitHub: github.com/nunomaduro
- Bluesky: bsky.app/profile/nunomaduro.b...
- Tiktok: / enunomaduro Наука
Wow, very nice and a super compact rundown, thx!
Thank you!
PHP getting better every new version .
Thank you very much ❤
awesome explanations!
Thank you!
thank you for your video
You welcome!
that thumb reflect my thoughts. I'm really considering migrate from JS to PHP too...
Try Laravel.
Great video nuno. I had one question. I have a legacy PHP application version 5.4 using zend, symfony, restler rtc. Wanted to upgrade it to the latest version. Is it better to rewrite it from scratch in a new framework like laravel or migrate everything and stay on the same frameworks
Great video Nuno 👏. Hopes PHP never ceased to improve and evolve. PHP should provide an easy and smooth transition for developers. What tool you used to change php version easily, using mac?
brew.sh/
@@nunomaduro Yes, I have been using it, however sometimes changes require a restart. Thanks anyway.
❤ PHP
What is the ABC app in the Menubar?
Certainly, to check whether you can override the variable $name marked as "readonly" or placed in the "readonly" class, you still need to run this code. That's how PHP works... You find out about existing errors in the code from clients using the production application ;)
PHPstan will help with this
This would be caught when unit testing. If this is caught in production it means you don’t test your code, which is wild
The only thing that is missing is typed arrays.
With PHPStan, we support those.
TypeScript is that you?
What is your font used in your IDE please ?
You like but you tell me :)
?
Now we only need the constructor to make the "{ }" optional because a lot of times it is just empty. Like we have in interfaces: public function __constructor (public string $name);
Would've been nice if we could remove empty {} as well
You sbould have showed off the algebraic types like string|null or Arryable&Responsable
Yeah - but wanted keep the example simple.
Do you know of any performance improvements in this new versión?
Sitll waiting for setters and getters.
I think proper standard engine support for async, futures, coroutines and threading is due
What would you use threading for? I'm interested to know what you have going on as challenge with which threading helps.
@@maxymajzr I'm currently generating loads of PDFs in parallel with Dompdf, the only way of not stalling the request for 15 minutes its to use Laravel Jobs but thats an architectural mess IMO (not very elegant to have an external program as supervisor, I found it breaks very often, doesn't reload the configuration properly, etc).
In the end I replaced it with proc_open with correct command arguments to run the proper job, marshalling job data into the database as JSON.
It would be trivial with a Thread Pool implementation, but I'd need to recompile the PHP interpreter and I don't know how fiddly the support is. Proper implementation and testing would take me a lot of time
Have you tried reactphp?
@jmon24ify
Looks interesting but I don't how useful it would be with my problem since Dompdf doesn't really block aside from when writing to disk once it has processed everything and I'd have to write a new service to even begin to try
@@GAoctavioyou can use pthreads, But generally I recommend to use something like Golang for heavy workload and offloading these parts.
PHP became a great and robust programming language! What a shame it's dying 😆
It's not dying. 👍🏻
@@nunomaduro it was a joke 😄
It was never great, and it will never be. Let it die.
@@levyroth Over my dead body
@@levyroth you would die first
I really like the direction PHP is developed in recent years. But unfortunately, it still sucks (and sadly will suck forever). It still has:
- The infamous inconsistent argument ordering: strpos($haystack, $needle, $offset) and array_search($needle, $haystack, $strict) - facepalm 🤦♂
- Lack of proper module system - importing all files to the global scope and bothering with complex namespaces is a nightmare
- Awful ancient "
You are right BUT:
- Inconsistent argument ordering - YES, but it is not a big deal, when you are using modern IDE
- Lack of proper module. Not sure what you mean, but it is solved by composer autoloader. Basically it is must have
- "
@@8LynX8 yeah, well I think backward compatibility causes most flaws of PHP, unfortunately 😅 I really hope they will eventually introduce more consistent APIs in future releases and deprecate old ones - then PHP would probably be one of the best server-side languages for backend devs
I agree about the inconsistencies in the argument ordering, but since PHP 8 you have this thing called named arguments. So you just need to know the name of the argument passed to that function and you can place the arg anywhere in the param signature
@@b0janix yeah, named arguments help a lot and I must admit that other languages should implement this feature as well (but this doesn't justify previous PHP's bad design decisions)
Nevertheless I wish PHP will fix some of its flaws in future versions, maybe it is going to be great some day ;)
seems you haven't used composer 2 and php 8.2 and some recent framework like laravel or symfony, about 90% of your issues are solved. add phpstan level 10 and strict type on top and you will never have any major issues in general.