Laravel News
1,520 FOLLOWERS
Laravel News is the official blog of Laravel. Every day bringing you the latest news, tutorials, and packages for the framework.
Laravel News
6h ago
Alpine.js has a new first-party Sort plugin in the ecosystem, which allows you to easily re-order elements by dragging them with your mouse. The Sort plugin uses the SortableJS project under the hood for the heavy lifting of sorting elements and provides a nice API for Alpine:
<ul x-sort>
<li x-sort:item>foo</li>
<li x-sort:item>bar</li>
<li x-sort:item>baz</li>
</ul>
This small, yet mighty plugin provides the following features:
Sorting groups
Custom drag handles
Support for Ghost elements
Customizable configuration for SortableJ ..read more
Laravel News
1d ago
This week, the Laravel team released v11.5, with anonymous event broadcasting, Blade performance improvements, generating URLs with query parameters, and more.
Anonymous Event Broadcasting
Joe Dixon contributed anonymous broadcasts in Laravel for real-time applications using Laravel Echo:
Sometimes you may wish to broadcast an ad-hoc event.
An ad-hoc event is one where you don't need to hook into it anywhere else in your application. You just want to notify the frontend of something.
For this, you don't want to go to the trouble of creating a brand new event, you just want to fire off a mess ..read more
Laravel News
2d ago
The clarity-laravel package lets you easily integrate Microsoft Clarity into your Laravel application. I wasn't familiar with Clarity before seeing this package—it's a GDPR and CCPA-ready product that you embed in your application, and it can capture how people use your site:
Heatmaps with Microsoft Clarity
The main features that Clarity offers your application include:
Heatmaps
Session recordings
Insights
Google Analytics integration
Integration is easy with this package: you set up a few environment variables and include the package's Blade component in your application's layout file:
&l ..read more
Laravel News
3d ago
Filterable is a Laravel package by Jerome Thayananthajothy that enhances Laravel queries with adaptable, customizable filters and intelligent caching to improve both performance and functionality.
The main features of this package include:
Dynamic Filtering: Apply filters based on request parameters with ease.
Caching: Improve performance by caching query results.
User-specific Filtering: Easily implement filters that depend on the authenticated user.
Custom Filter Methods: Extend the class to add your own filter methods.
Defining Filter classes is at the center of this package, where you c ..read more
Laravel News
6d ago
The Property Hooks RFC passed a significant milestone, getting an overwhelmingly positive 34 "yes" votes and only 1 "no" vote. That's well above the required 2/3 majority required to pass.
What are property hooks in PHP?
Here's the proposal summary from the RFC:
Developers often use methods to wrap and guard access to object properties. There are several highly common patterns for such logic, which in practice may be verbose to implement repeatedly. Alternatively, developers may use __get and __set to intercept reads and writes generically, but that is a sledge-hammer approach that intercept ..read more
Laravel News
1w ago
This week, the Laravel team released v11.4, with reversible form Prompts, a new Exceptions facade, Enum support in the Collection::mapInto() method, and more.
Introduce the Exceptions Facade
Nuno Maduro contributed the Exceptions facade:
The Exceptions facade provides a consistent way to test exceptions in Laravel applications. Here is the list of methods that the Exceptions facade provides:
assertReported
assertReportedCount
assertNotReported
assertNothingReported
throwOnReport
throwFirstReported
Here's an example from the pull request description illustrating the Exceptions::fake() meth ..read more
Laravel News
1w ago
It's 2024 and I'm calling it - Server-Side Rendering has officially made a comeback:
in Laravel, where Livewire now has 46.000 installs per day
in Ruby on Rails with Hotwire
in Phoenix with Liveview
in web dev in general with HTMX
Now that "the old has become the new"... maybe it's time to re-visit another practice we've adopted from the Javascript ecosystem. Maybe it's time to... drop the build step? Crazy, I know! But there's been a lot of talk about no-build Laravel setups in my bubble. And there's one place where people invariably get stuck - "If we drop NPM, what do we do about JS depe ..read more
Laravel News
1w ago
The Random package by Stephen Rees-Carter, generates cryptographically secure random values in a range of different formats through a simple helper package for PHP. Here is why this package was created:
Something I commonly encounter during my security audits (especially on older codebases) is insecure randomness, usually in places where security is required. It’s usually using some form of rand(), often injected inside md5() to generate a random hash, combined with str_shuffle() to generate new passwords, or used to make an One-Time Password (OTP) with rand(100_000, 999_999).
The problem ..read more
Laravel News
1w ago
PhpStorm has good automatic formatting of PHP files based on standards like PSR-2, PSR-12, Symfony, Laravel, etc.; however, there have not been a lot of options for consistently formatting blade files in PhpStorm until recently. There are whispers of Blade formatting coming to Laravel Pint, but another interesting option is using the JavaScript's Prettier code formatting tool with the prettier-plugin-blade plugin.
Matt Stauffer's article How to set up Prettier On a Laravel App, Linting Tailwind Class Order and More is an excellent primer to formatting Tailwind and Blade using Prettier.
Here's ..read more
Laravel News
2w ago
PhpStorm, the PHP IDE by JetBrains, released version 2024.1 this week with a brand new terminal, local AI code completion, Pest improvements, and more.
The new terminal in PhpStorm 2024.1
Here's the list of highlights from this release:
New terminal
Full line code completion with local AI
Sticky lines pinned to the top in the editor
Pest Improvements
PHPUnit 11.0 support
Support for Symfony’s AssetMapper
Improvements to dd(), var_dump(), and Symfony's var-dumper
Check for vulnerable packages in composer.json
Frontend updates
Component usages for Vue, Svelte, and Astro
Language services widg ..read more