Laravel News
398 FOLLOWERS
Laravel News is the official blog of Laravel. Every day bringing you the latest news, tutorials, and packages for the framework.
Laravel News
4h 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
1d 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
4d 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
5d 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
6d 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
1w 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
Laravel News
1w ago
This week, the Laravel team released v11.3, which includes multi-line text in Laravel Prompts, a Session:hasAny() method, a Context::pull() method, and more.
Multi-line Text Prompts
Joe Tannenbaum contributed a textarea function to Laravel prompts that accepts multi-line text from a user:
Multi-line text input in Laravel Prompts
The textarea() function includes an optional validation argument as well as a required argument to make sure the textarea is filled out:
use function Laravel\Prompts\textarea;
$story = textarea(
label: 'Tell me a story.',
placeholder: 'This is a story about ..read more
Laravel News
2w ago
The Bartender package for Laravel is an opinionated way to authenticate users using Laravel Socialite. Bartender serves you a controller, routes, and a default implementation for handling authentication with Laravel Socialite providers. Almost everything in Bartender can be customized.
Using the configuration conventions, you can enable social logins by defining the routes and configuring the providers you're app will support:
// routes/web.php
use DirectoryTree\Bartender\Facades\Bartender;
Bartender::routes();
// config/services.php
return [
// ...
'google' => ..read more