What's new in PHP 8.4?

Поделиться
HTML-код
  • Опубликовано: 15 янв 2025

Комментарии • 85

  • @imqqmi
    @imqqmi 2 месяца назад +53

    PHP more and more looks like C#, I think it's a good thing.

    •  2 месяца назад +4

      PHP#

    • @imqqmi
      @imqqmi 2 месяца назад

      Very sharp!

    • @stjepanmajdak7396
      @stjepanmajdak7396 2 месяца назад +1

      And C# is getting some unique PHP features with almost every new version

    •  Месяц назад

      @@stjepanmajdak7396 could you elaborate? That's interesting. I'm just curious, I've been using C# only little, two digits years ago.

  • @erickdeazevedolima1763
    @erickdeazevedolima1763 2 месяца назад +17

    I've been waiting for the asymetric visibility + property hooks combo for a decade (I used them in C# all the time before diving for real in PHP). I'm really excited for it.

  • @fabio.antunes
    @fabio.antunes 2 месяца назад +2

    Hello. Just found your channel thanks to this video. Thanks for the summary and straight to the point examples. Awesome.

  • @nobodyspecial946
    @nobodyspecial946 2 месяца назад +9

    I rewinded more than 5 times to moment 3:36 :D They way you said it and you face expression make me laugh so much :D "It took them more than decade to add, but HEY! IT'S HERE"

  • @zonegamma8197
    @zonegamma8197 2 месяца назад +2

    cool to see the language evolving a lot these last years

  • @qqleq
    @qqleq 2 месяца назад +3

    Love it all! I used property get/set/let all the time when I was programming in VBA I think even thirty years ago! Finally I can do something similar, but better, in PHP. I think I will use almost all of the updates immediately, I have been needing them all for quite some time.

    • @pierrepracht
      @pierrepracht 2 месяца назад

      30 years later...

      Only in PHP !

  • @GuzikPL4
    @GuzikPL4 2 месяца назад +2

    Some time a go Aaron Francis did a video about what changed in PHP since 2012 and i absolutely love these kind of videos. I would love to see more tricks and cool features i can use.

    • @phpannotated
      @phpannotated  2 месяца назад +2

      Ah yes, I remember that video. Aaron's great!
      In my defence though, I was the first one to do such an evolution video (and Aaron made a better version inspired by mine :p )
      ruclips.net/video/x9bSUo6TGgY/видео.html

  • @taghwomillionaireo.5543
    @taghwomillionaireo.5543 Месяц назад +1

    Didn’t really understand the asymmetric visibility RFC, thanks for the explanation

  • @lostcarpark
    @lostcarpark 2 месяца назад +3

    Very excited about property hooks, though asymmetric visibility means most of the time they won't even be needed.

    • @phpannotated
      @phpannotated  2 месяца назад +1

      Absolutely true! Gonna be HUGE

  • @3fcf91cb4e
    @3fcf91cb4e Месяц назад

    Would love to see your view on Magento's approach to backend, or maybe an interview with someone experienced with it - there's a lot of interesting stuff to talk about.
    I've been working with it for years and there's so many awful implementations of this platform that maybe a video on the standards and principles it uses could help some developers realize how much stuff they do wrong.
    And not going to lie - a video/podcast that would summarize some of the basic PHP principles and guidelines (not even diving into detail) would be a blessing for the juniors I work with, not sure if you have one already

  • @mr_raspberry_jam
    @mr_raspberry_jam 2 месяца назад +1

    Where can I get one of them php elephants you have behind you?

  • @xelframework
    @xelframework 2 месяца назад +1

    properties hook are very interesting feature so far on php 8.4

  • @coder236
    @coder236 2 месяца назад +2

    When they eventually bring out 9 I'd love them to add a decent concurrency model

    • @phpannotated
      @phpannotated  2 месяца назад +1

      Oooh yeah that would be nice! I remember some people were looking at lib-uv compatibility around the 8.0 era for async/await support, but I don't think anything came from it

    • @coder236
      @coder236 2 месяца назад +2

      @@phpannotated if they could add it i think php would boom again. i love php but have been thinking of handing certain tasks over to a node or GoLang server for heavy lifting. anyway, keep up the awesome content ✌

    • @lostcarpark
      @lostcarpark 2 месяца назад +1

      Fibres gets close, especially with revolt, and I think could be developed into full concurency. What I don't like about async/await in JS is the way it is used for many things that 99% of the time you want to use completely synchronously, but you have to include asynchronous boilerplate for the rare asynchronous use cases. I hope we can come up with a syntax that enables better concurency without imposing extra burden on simple use cases that just want to call an action and wait for it to finish.

    • @zebraforceone
      @zebraforceone 2 месяца назад

      Check out fibres

  • @Pekz00r
    @Pekz00r 2 месяца назад

    Asymetric visibility is a game changer! I tend to use public properties more often than I should because it is so annoying to create and call getters for every property. I'm really looking forward to never write a simple property getter without any logic again. For the times you need some basic logic property hooks are also great!

  • @NeverCodeAlone
    @NeverCodeAlone Месяц назад

    Very good video. Thanks a lot.

  • @prometheus6001
    @prometheus6001 2 месяца назад

    What IDE is that and if its IDEA, what template or how did you get to that look and feel?

    • @phpannotated
      @phpannotated  2 месяца назад

      It's PhpStorm with the new layout (enabled by default in newest installs), and my custom color scheme: github.com/brendt/phpstorm-light-lite-theme

  • @svobodnjk
    @svobodnjk 2 месяца назад +2

    And still no generics... 😢

    • @SXsoft99
      @SXsoft99 2 месяца назад

      you kinda have them as comments but not enforced :))
      /** @var array $variable */
      It helps with the IDE a lot
      you can also have complex ones
      /** @var array{name:string, tags:array{name:string}} */
      works with @prop/@property-read/@method

  • @rustix3
    @rustix3 2 месяца назад

    I see a lot of things available in other languages are adopted in PHP, which is good.
    But when will set and map/dictionary data types be available outside of the box in PHP?

    • @zebraforceone
      @zebraforceone 2 месяца назад

      Associative arrays are a map

    • @SXsoft99
      @SXsoft99 2 месяца назад

      do you work only with auto indexed arrays?
      have you never done:
      $arr=[];
      $arr['name']='test';
      $arr['list']=['test_key' => 'text_val'];
      ?

  • @pranansubba9587
    @pranansubba9587 Месяц назад

    Idk why but getter and setter sounds quite logical if working in framework.

  • @SXsoft99
    @SXsoft99 2 месяца назад

    My DTO classes will become much cleaner :))

  • @CottonInDerTube
    @CottonInDerTube 2 месяца назад

    3:00 That feels wrong. Doesnt this require a __construct to return $this (which actually returns void only)?

    • @krycekaiolfi
      @krycekaiolfi 2 месяца назад

      The __construct is, returns void. But the 'new' keyword returns an object.

  • @31redorange08
    @31redorange08 2 месяца назад

    Are there any use cases for PHP outside of extending CMS?

    • @SXsoft99
      @SXsoft99 2 месяца назад

      - server-side CLI(Terminal) scripting,
      - automatic queue system in conjunction with linux supervisorCTL
      - desktop apps(be it a niche)
      - Web APIs, you can respond with Json, xml, file stream, etc. You are not limited to HTML

    • @31redorange08
      @31redorange08 2 месяца назад

      @SXsoft99 I know that these things are possible, but why would you choose PHP over other languages (other than only knowing PHP)?

    • @merlin-1d
      @merlin-1d 2 месяца назад

      Yes, if you're a developer and you're honest with yourself, you know exactly why😉

    • @LatenightDev
      @LatenightDev Месяц назад

      @@31redorange08 Who says that ? What makes you think those who use PHP don't use other languages?

    • @31redorange08
      @31redorange08 Месяц назад

      @@LatenightDev That's not what I was saying.

  • @Tigerman55
    @Tigerman55 2 месяца назад

    I think property hooks are more applicable to legacy projects (maybe), than it is to new code. You can use readonly classes and then you don't need any getters or setters anyways. Passing objects into a service with named constructors prevents the need for logic in either getters or setters. So it is moot point for most modern cases.
    Readonly with only private mutation is useful in some cases, I think.

    • @SXsoft99
      @SXsoft99 2 месяца назад

      Not necessarily, you might want to set certain values in the constructor based on another value. Currently you either do it when you instantiate the class, or in the constructor but you move the property from being defined in your constructor method to being as a class property.
      The read only private thing is more than you can finally use the interfaces to define this functionality while currently you can only have props public.

  • @llBestBoyll
    @llBestBoyll 2 месяца назад

    That was vert informative thx ❤

  • @badasukerubin
    @badasukerubin 2 месяца назад

    I can't wait for property hooks

  • @holonaut
    @holonaut 2 месяца назад

    Generics when?

    • @jsomhorst
      @jsomhorst 2 месяца назад

      Never. Search and see it is really hard to implement in a language like this

    • @holonaut
      @holonaut 2 месяца назад

      @jsomhorst actually generics already work with annotations and phpstan. PHP maintainers are just not adding it to the language out of spite at this point

    • @jsomhorst
      @jsomhorst 2 месяца назад

      @holonaut yes I know. That is the IDE doing it's thing. PHP doesn't care.

  • @GopherOnline
    @GopherOnline 2 месяца назад +1

    echo great video

  • @marius-v4s
    @marius-v4s 2 месяца назад

    property hooks in interfaces is fucking huuuuge, they're cooking good

  • @abrahamolaobaju1781
    @abrahamolaobaju1781 Месяц назад

    looking good

  • @susanthawarnapura
    @susanthawarnapura 2 месяца назад +4

    forget PHP 8.4 we need generic support and strict types

  • @aurelian3401
    @aurelian3401 2 месяца назад +1

    print 'ok'; // amazing

  • @asagiai4965
    @asagiai4965 2 месяца назад

    Hmm the ability to make setter private.
    Where have I seen that? Ah yes VB
    Maybe there's also in C#
    Anyway I think these are ok features.

  • @honk_tm
    @honk_tm 2 месяца назад +1

    yes, I hate property hooks, other things are absolutely welcomed

  • @robwatson826
    @robwatson826 2 месяца назад

    All I want is a function autoloader then I'll be totally happy with PHP

    • @SXsoft99
      @SXsoft99 2 месяца назад

      in your composer.json
      {
      ...,
      "autoload": {
      "files": [
      "app/Helpers/helpers.php",
      ],
      },
      ...
      }

  • @a-yon_n
    @a-yon_n 2 месяца назад

    Yet still doesn't have variable type notations and generics. It's frustrating to see a language evolve so much but actually change so little. I will never use PHP again until it has these two features.

  • @farhanasultana9213
    @farhanasultana9213 2 месяца назад +2

    PHP needs front end async features instead on relying on js, which will make it a full stack language.

    • @LatenightDev
      @LatenightDev Месяц назад

      php doesn’t need to be asynchronous. as every request uses its own php thread. need to scale php? add more workers in your webserver. need to scale nodejs: run multiple instances behind a load balancer and carefully manage listening ports. php makes life easy, when low latency isn’t a strict requirement.

  • @nikolayivanov321
    @nikolayivanov321 2 месяца назад

    Not sure how I feel about being able to use property hooks for promoted properties, I can see this getting ugly real fast. Other than that, it seems like a fantastic release.

  • @MLHAFAKOT
    @MLHAFAKOT 2 месяца назад

    Stop using bright mode

    • @phpannotated
      @phpannotated  2 месяца назад

      ruclips.net/video/mu0HJ0_kprc/видео.html

  • @David-ng9qh
    @David-ng9qh 2 месяца назад

    I really dislike the new deprecation of the implicitly marking a function parameter as nullable if it's default value is null. This was a great marker that a user should not pass in null, but that the implementation would resolve to a default (non-const) value at runtime if nothing was provided. I do not understand why this is deprecation worthy, I get that it is a weird thing, but it is also a great design pattern and is quite literally used everywhere. I use it everywhere, and laravel/framework does too.
    I understand just making the type nullable does not affect the way PHP handles this scenario at all, but it's about the semantics the consumer of a library will deal with, which will now be worse.
    Example
    ```php
    function a(int $b = null) {
    $b ??= get_default_value_for_b();
    // ...
    }
    a(); // user knows not to pass in null
    a(1); // good

    • @phpannotated
      @phpannotated  2 месяца назад

      Interesting! I personally never considered that use case 🤔

    • @SXsoft99
      @SXsoft99 2 месяца назад

      they want to do it because a lot of devs abuse it and it leads to a lot of errors

  • @turi.commodore
    @turi.commodore 2 месяца назад

    i'm thinking of all the useless getters in my aggregates that will FINALLY be dropped thanks to private(set)....
    hell yeah

  • @CottonInDerTube
    @CottonInDerTube 2 месяца назад

    0:50 omg! Im not bi***ing, i just dont understand why this would make things better :D
    But hey - we can still use getters and setters =)
    _Which i will 100% do until i die._

    • @Someniatko
      @Someniatko 2 месяца назад

      One use case is that you can add more logic to an already existing without having to convert all its users to use a getter/setter, keeping backwards compatibility

  • @Rhmtsky
    @Rhmtsky Месяц назад

    Meh, i'll stick to 8.2 til php 9 released then.

  • @MelroyvandenBerg
    @MelroyvandenBerg 2 месяца назад

    HTML5 support took only a decade to add hhaha. Classic

  • @danser_theplayer01
    @danser_theplayer01 2 месяца назад

    The language name sounds like some old vacuum cleaner coughed up dust.
    pghhp💨

  • @Alex-pg1gt
    @Alex-pg1gt 2 месяца назад +1

    Meh

  • @rickmyers7627
    @rickmyers7627 2 месяца назад

    Why not use magic methods for getting rid of getters and setters... seriously, this reason is why I left programming Java... PHP's magic methods, and autoloaders, are amazing and make coding "conventions over configuration" a breeze.

    • @krycekaiolfi
      @krycekaiolfi 2 месяца назад

      Magic methods doesn't play nice with static analysis, intellisense, etc.