Newslurp

<< Stories

Laravel 11.30 Released πŸš€, Sleep helper class πŸ’‘, State of CSS 2024 Results πŸ“Š, You Want Modules, Not Microservices 🧩

The Laralist <hello@thelaralist.com>

November 3, 11:27 am

Laravel 11.30 Released πŸš€, Sleep helper class πŸ’‘, State of CSS 2024 Results πŸ“Š, You Want Modules, Not Microservices 🧩
This release introduces `withDefer()` and `withoutDefer()` test helpers to manage deferred calls during testing. It also debuts the `HasUniqueStringIds` trait, enabling custom unique string IDs for Eloquent models to be used efficiently as route keys. Additionally, the `authorize()` method now accepts Backed Enums directly, simplifying authorization checks by allowing direct enum usage (From `$this->authorize(DashboardPermission::VIEW->value)` to `$this->authorize(DashboardPermission::VIEW)`).
β€Š
The Laralist
3rd of November, 2024
🧱
Laravel

This release introduces withDefer() and withoutDefer() test helpers to manage deferred calls during testing. It also debuts the HasUniqueStringIds trait, enabling custom unique string IDs for Eloquent models to be used efficiently as route keys. Additionally, the authorize() method now accepts Backed Enums directly, simplifying authorization checks by allowing direct enum usage (From $this->authorize(DashboardPermission::VIEW->value) to $this->authorize(DashboardPermission::VIEW)).

Explore Laravel's built-in PHP attributes to enhance metadata handling across classes and methods, including ObservedBy for model observers and ScopedBy for global scopes. Discover practical implementations like WithoutRelations for loading models without their relationships and DeleteWhenMissingModels for auto-deleting jobs when models are absent.

Explore the essentials of managing sessions in Laravel, covering session fundamentals, practical usage with session classes, and testing techniques. Learn to avoid common pitfalls and ensure robust session handling in your applications.

Laravel Volt enhances Livewire by allowing developers to create single-file components, integrating backend and frontend code in one place. This article details installation, usage, and testing of both class-based and functional Volt components, highlighting their simplicity and efficiency for streamlined development.

πŸ’‘
Tip of the Week

With the Sleep helper class, you can easily specify delays in seconds, milliseconds, or even until a specific time. In testing, you can fake sleep to avoid real delays and make assertions on timing.

Sleep::for(1)->second();
Sleep::for(2)->milliseconds();
Sleep::for(3)->microseconds();
// ...

// In testing
Sleep::fake();

Sleep::assertSequence([
    Sleep::for(1)->second(),
    Sleep::for(2)->milliseconds(),
    Sleep::for(3)->microseconds(),
]);
Sleep::assertSleptTimes(3);
🐘
PHP

Tempest's latest alpha release features significant updates including refactored view handling with compiled and cached views, newly added regex parameters in routing, the introduction of a defer() helper for post-response tasks, and initializers for injecting grouped dependencies. Additionally, custom installers are highlighted, showcasing ongoing community contributions and development momentum.

Learn to handle BadResponseException in Guzzle by customizing the exception message length. This tutorial shows how to modify the handler stack to include a BodySummarizer with an increased truncation limit for more detailed error insights.

πŸ“¦
Package of the Week

Ideal for listing websites with visual flair, it dynamically fetches favicons using Laravel’s HTTP client, making directories or portfolios visually appealing by including each site’s favicon next to its link.

✨
Misc

State of CSS 2024 results are available, heralding a shift from "CSS Classic" to "New CSS." This evolution introduces powerful features like Subgrid, :has(), and container queries, reducing reliance on JavaScript and external tools, and opening up new possibilities for web design.

This article critically examines the microservices hype, tracing its roots to earlier technologies and emphasizing the recurring themes in software architecture. It questions the novelty of microservices, highlighting how many of their benefits have been long achievable with modular programming and urging a reevaluation of what architectural changes are genuinely necessary.

β€Š
We value your thoughts and feedback. Feel free to hit reply and share your ideas with us.
If you find our content helpful, please consider forwarding it to your friends and colleagues.
Thank you for reading,
Mario & Javi
β€Š
If you prefer not to receive future editions of The Laralist, please unsubscribe.