PHPackages                             outerweb/filament-link-picker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. outerweb/filament-link-picker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

outerweb/filament-link-picker
=============================

This package adds a field to pick a link from your defined routes or external links.

v3.1.0(1y ago)05561MITPHPPHP ^8.0

Since Mar 1Pushed 1y agoCompare

[ Source](https://github.com/outer-web/filament-link-picker)[ Packagist](https://packagist.org/packages/outerweb/filament-link-picker)[ Docs](https://github.com/outer-web/filament-link-picker)[ RSS](/packages/outerweb-filament-link-picker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (16)Used By (0)

Filament Link Picker
====================

[](#filament-link-picker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4b97617873112bb8409f39101b437cbf486b08d8fd90140f022121ba099e0266/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f757465727765622f66696c616d656e742d6c696e6b2d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/filament-link-picker)[![Total Downloads](https://camo.githubusercontent.com/5bb277531c0df2b7fa11f96d1e7102f3635d55819e15f1b6b6cb7ccb0a31d8ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f757465727765622f66696c616d656e742d6c696e6b2d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/filament-link-picker)

This package adds a field to pick a link from your defined routes or external links. It also adds a blade component to render the links.

Features
--------

[](#features)

The link picker field will show the following options:

- A list of all your application routes that are marked for the link picker to discover.
- An external link option to add a link to an external website. (Can be disabled)
- An email link option to add a mailto link. (Can be disabled)
- A telephone link option to add a tel link. (Can be disabled)

The link picker will automatically show and bind the parameters of the selected route. This includes:

- A select field powered by route model binding to automatically show the available models.
- A text input field for all other parameters.
- An url input field for the external link option.
- An email input field for the email link option.
- A tel input field for the telephone link option.

The link picker can also show route options:

- `is_download` to specify if the link is a download link.
- `opens_in_new_tab` to specify if the link should open in a new tab.

The link can be rendered using the `` blade component.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require outerweb/filament-link-picker
```

Add the plugin to your desired Filament panel:

```
use OuterWeb\FilamentLinkPicker\Filament\FilamentLinkPicker;

class FilamentPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugins([
                FilamentLinkPickerPlugin::make(),
            ]);
    }
}
```

Configuration
-------------

[](#configuration)

### Disabling the external link option

[](#disabling-the-external-link-option)

You can disable the external link option by adding the `disableExternalLinks` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->disableExternalLinks();
```

### Disabling the email link option

[](#disabling-the-email-link-option)

You can disable the email link option by adding the `disableMailto` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->disableMailto();
```

### Disabling the telephone link option

[](#disabling-the-telephone-link-option)

You can disable the telephone link option by adding the `disableTel` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->disableTel();
```

### Disabling the 'download' option

[](#disabling-the-download-option)

You can disable the 'download' option by adding the `disableDownload` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->disableDownload();
```

### Disabling the 'opens in new tab' option

[](#disabling-the-opens-in-new-tab-option)

You can disable the 'opens in new tab' option by adding the `disableOpenInNewTab` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->disableOpenInNewTab();
```

### Multi language support

[](#multi-language-support)

You can enable multi language support by adding the `translateLabels` method to the plugin.

```
FilamentLinkPickerPlugin::make()
    ->translateLabels();
```

The following items can be translated:

- label: The label of the route defined in the `filamentLinkPicker()` method.
- group: The group of the route defined in the `filamentLinkPicker()` method.
- parameter labels: The labels of the parameters defined in the `filamentLinkPicker()` method.

To do so, just set the values to the translation key.

```
Route::get('/your-route/{parameter}', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        label: 'your-route.label',
        group: 'your-route.group',
        parameterLabels: [
            'parameter' => 'your-route.parameter',
        ]
    );
```

Usage
-----

[](#usage)

### Setting up routes

[](#setting-up-routes)

You can mark a route for the link picker to discover by adding the `filamentLinkPicker()` method to the route.

```
use Illuminate\Support\Facades\Route;

Route::get('/your-route', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker();
```

#### Customizing the route's label

[](#customizing-the-routes-label)

The label of the route will be used in the dropdown of the link picker. You can customize the label by passing it as an argument to the `filamentLinkPicker()` method.

```
Route::get('/your-route', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        label: 'Your custom label'
    );
```

By default, the label will be the route's name. If the route name contains dots, they will be replaced by '&gt;'.

#### Customizing the route's group

[](#customizing-the-routes-group)

The group will be used to group the routes in the dropdown of the link picker. You can customize the group by passing it as an argument to the `filamentLinkPicker()` method.

```
Route::get('/your-route', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        group: 'Your custom group'
    );
```

#### Marking the route as 'localized'

[](#marking-the-route-as-localized)

Marking a route as 'localized' will make the link picker combine all localized versions of that route. This is useful when you have a multi-language where you have the same route for different languages so that the link picker does not show the same route multiple times. See the [Localization](#localization) section for more information.

```
Route::get('/your-route', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        isLocalized: true
    );
```

#### Defining specific parameter labels

[](#defining-specific-parameter-labels)

You can define specific parameter labels for the route by passing an array to the `filamentLinkPicker()` method. These labels will be used in the link picker as labels for the parameter input fields.

```
Route::get('/your-route/{parameter}', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        parameterLabels: [
            'your-parameter' => 'Your parameter label'
        ]
    );
```

#### Defining specific parameter options

[](#defining-specific-parameter-options)

You can define specific parameter options for the route by passing an array to the `filamentLinkPicker()` method. These options will be used in the link picker as options for the parameter select field.

```
Route::get('/your-route/{parameter}', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        parameterOptions: [
            'your-parameter' => [
                'option1' => 'Option 1',
                'option2' => 'Option 2',
            ]
        ]
    );
```

#### Explicitly defining the column name to store the value in the database

[](#explicitly-defining-the-column-name-to-store-the-value-in-the-database)

By default, the package will use the `$model->getKey()` method to store the selected value of a parameter in the database. If you want to store the value in a different column, you can pass the column name as an argument to the `filamentLinkPicker()` method.

```
Route::get('/event/{event:slug}', 'show')->name('show')->filamentLinkPicker(
        label: 'Single Event',
        group: 'Details Page',
        parameterModelKeys: [
            'event' => 'slug',
        ]
    );
```

### Setting up route model binding

[](#setting-up-route-model-binding)

Route model binding is supported by default. The link picker will automatically show the available models in the parameter select field. It will save the primary key of the model to the database.

By default, we go through the following attributes to automatically find the model's label:

- label
- name
- title

If none of these attributes are found, the application will throw an exception.

#### Explicitly defining the model's label

[](#explicitly-defining-the-models-label)

You can explicitly define the model's label by adding a `getLinkPickerLabel` method to the model.

```
class YourModel extends Model
{
    public function getLinkPickerLabel(): string
    {
        return $this->your_attribute;
    }
}
```

Or you can define the label as a property on the model.

```
class YourModel extends Model
{
    public string $linkPickerLabel = 'your_attribute';
}
```

#### Filtering the available models

[](#filtering-the-available-models)

You can filter the available models by adding a `scopeLinkPickerOptions` method to the model. This scope will then be applied to the model's query when fetching the available options for the select field.

```
class YourModel extends Model
{
    public function scopeLinkPickerOptions(Builder $query): void
    {
        // Your query here
    }
}
```

### Localization

[](#localization)

The link picker can handle localized routes well. To do so, follow these steps:

1. Mark the route as 'localized' by adding the `localized` argument to the `filamentLinkPicker()` method on your route.

```
Route::get('/your-route', YourController::class)
    ->name('your-route')
    ->filamentLinkPicker(
        isLocalized: true
    );
```

2. Configure how the link picker should combine the localized routes by adding the `combineLocalizedRoutesUsing` method to the plugin.

```
use Outerweb\FilamentLinkPicker\Entities\LinkPickerRoute;

FilamentLinkPickerPlugin::make()
    ->combineLocalizedRoutesUsing(function (LinkPickerRoute $route): LinkPickerRoute {
        // Imagine your routes are named like `en.your-route` and `nl.your-route`
        // We want to combine these routes so that the link picker only shows one option for `your-route`
        return $route->name(Str::after($route->name(), '.'));
    });
```

By default, the package will combine the localized routes by removing the part of the name before the first dot. If you want to use this behavior, you do not need to specify the `combineLocalizedRoutesUsing` method.

3. Configure how the link picker should build the localized routes by adding the `buildLocalizedRouteUsing` method to the plugin.

```
use Outerweb\FilamentLinkPicker\Entities\LinkPickerRoute;

FilamentLinkPickerPlugin::make()
    ->buildLocalizedRouteUsing(function (string $name, array $parameters = [], bool $absolute = true, ?string $locale = null): ?string {
        // If you use our `outerweb/localization` package,
        // You can use the `localizedRoute` helper.
        return localizedRoute($name, $parameters, $absolute, $locale);
    });
```

As a fallback, when you do not specify a callback function, the link picker will use the `outerweb/localization` package to build the localized routes if it is installed. This package provides a `localizedRoute` helper that you can use in your application. Read more about this package [here](https://github.com/outer-web/localization).

### Using the actual value

[](#using-the-actual-value)

To use the actual value of the link, you can cast the attribute in your model or use the facade.

#### Casting

[](#casting)

You can cast your model's attribute to the `Outerweb\FilamentLinkPicker\Entities\Link` class to take advantage of the entity's properties and methods.

```
use Outerweb\FilamentLinkPicker\Casts\LinkCast;

class YourModel extends Model
{
    protected $casts = [
        'link' => LinkCast::class,
    ];
}
```

#### Using the facade

[](#using-the-facade)

You can use the `Outerweb\FilamentLinkPicker\Facades\LinkPicker` facade to cast the value to a `Link` entity.

```
use Outerweb\FilamentLinkPicker\Facades\LinkPicker;

$link = LinkPicker::dataToLinkEntity(array $data);
```

### Rendering the link

[](#rendering-the-link)

You can use the `` blade component to render the link.

```

    Your label here

```

The link picker options like `is_download` and `opens_in_new_tab` will only take effect when you do not specify them on the component itself. If you do specify them, the component will use the specified values.

```

```

Here, we specified the `download` and `target` attributes. The component will use these values instead of the ones from the link picker.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Simon Broekaert](https://github.com/SimonBroekaert)
- [Nuhel](https://github.com/Nuhel)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance44

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Recently: every ~84 days

Total

15

Last Release

445d ago

Major Versions

v1.4.0 → v2.0.02024-03-27

v2.0.1 → v3.0.02024-05-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5a072b1191f02ac21a84af067a579b6f3323da7e45197369a7540f98c152407?d=identicon)[outerweb.be](/maintainers/outerweb.be)

---

Top Contributors

[![SimonBroekaert](https://avatars.githubusercontent.com/u/35606498?v=4)](https://github.com/SimonBroekaert "SimonBroekaert (22 commits)")[![Nuhel](https://avatars.githubusercontent.com/u/30118433?v=4)](https://github.com/Nuhel "Nuhel (1 commits)")

### Embed Badge

![Health badge](/badges/outerweb-filament-link-picker/health.svg)

```
[![Health](https://phpackages.com/badges/outerweb-filament-link-picker/health.svg)](https://phpackages.com/packages/outerweb-filament-link-picker)
```

###  Alternatives

[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

118126.9k](/packages/stephenjude-filament-feature-flags)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[joaopaulolndev/filament-general-settings

Filament package to manage general settings

18129.7k](/packages/joaopaulolndev-filament-general-settings)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

9169.0k4](/packages/marcelweidum-filament-expiration-notice)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[marjose123/filament-webhook-server

Send webhooks from your filament apps

507.3k2](/packages/marjose123-filament-webhook-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
