pardalsalcap / linter-redirections
Add on to manage 404 and redirections into linter and filament
Package info
github.com/pardalsalcap/linter-redirections
pkg:composer/pardalsalcap/linter-redirections
Requires
- php: ^8.2
- filament/filament: ^5.0
- illuminate/contracts: ^11.0|^12.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.13|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
This package is auto-updated.
Last update: 2026-03-12 17:45:47 UTC
README
main targets Filament 5.
v3.0.0 is the last release compatible with Filament 3.
This package is an add-on for the Linter panel to manage 404s and redirections. It includes a Filament resource and two dashboard widgets.
Installation
You can install the package via composer:
composer require pardalsalcap/linter-redirections
If you need Filament 3 compatibility, install v3.0.0.
You can publish and run the migrations with:
php artisan vendor:publish --tag="linter-redirections-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="linter-redirections-config"
This is the contents of the published config file:
return [
];
Usage
To register the 404 or any Exception you like to monitor you can add the following code to your app/Exceptions/Handler.php file:
use Pardalsalcap\LinterRedirections\Repositories\RedirectionRepository; public function render($request, Throwable $e) { switch(class_basename($e)){ case 'NotFoundHttpException': $http_status = $e->getStatusCode(); $redirection_repository = new RedirectionRepository(); $redirection = $redirection_repository->check(request()->fullUrl()); if ($redirection) { return redirect($redirection->fix, $redirection->http_status); } if ($http_status == "404") { $redirection_repository->logError(request()->fullUrl(), $http_status); } break; } return parent::render($request, $e); }
In Laravel 11 you can modify the /bootstrap/app.php file to add the following code:
->withExceptions(function (Exceptions $exceptions) { $exceptions->render(function (NotFoundHttpException $e, Request $request) { $http_status = $e->getStatusCode(); $redirection_repository = new RedirectionRepository(); $redirection = $redirection_repository->check(request()->fullUrl()); if ($redirection) { return redirect($redirection->fix, $redirection->http_status); } if ($http_status == "404") { $redirection_repository->logError(request()->fullUrl(), $http_status); } //return view('errors.404'); }); })
If you want to log any other exception you can add it to the switch case.
Filament Resource
To manage redirections from your Filament panel, create an app resource that extends the package resource:
<?php namespace App\Filament\Resources; class RedirectionResource extends \Pardalsalcap\LinterRedirections\Resources\RedirectionResource { // Any additional logic here }
Widgets
To add the widgets to your Filament panel dashboard, register them in your panel provider:
RedirectionsStats::class,
RedirectionsDashboardWidget::class,
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.