Best of stitcher.ioJuly 2024

  1. 1
    Article
    Avatar of stitcherstitcher.io·2y

    New without parentheses in PHP 8.4

    PHP 8.4 introduces a feature allowing developers to create new objects without parentheses, simplifying code and enabling method chaining directly on newly created objects. This update extends to methods, properties, static methods, and even supports dynamic and anonymous classes. However, constructor brackets remain mandatory for class instantiation to avoid parsing ambiguities. Despite minor limitations, this syntactic sugar promises to enhance coding efficiency.

  2. 2
    Article
    Avatar of stitcherstitcher.io·2y

    Improved lazy loading

    The post discusses the design and implementation of an ORM named Tempest, focusing on improved lazy loading mechanisms. The key approach includes using typed properties for static analysis, making minimal configuration necessary by inferring relations directly from property types and docblocks. It contrasts Tempest's strict lazy loading with Laravel's default approach which allows lazy loading, thereby preventing n+1 query problems and optimizing performance. The post also explores PHP's technical details, including handling uninitialized properties and triggering property accessors for lazy loading.