PHPackages                             pstaender/kirby-uri-field - 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. pstaender/kirby-uri-field

ActiveKirby-plugin

pstaender/kirby-uri-field
=========================

Kirby 3 uri field which can be assigned also assigned to a page or a file.

v0.0.3(3y ago)11.1kMITPHP

Since Sep 21Pushed 3y ago2 watchersCompare

[ Source](https://github.com/pstaender/kirby-uri-field)[ Packagist](https://packagist.org/packages/pstaender/kirby-uri-field)[ RSS](/packages/pstaender-kirby-uri-field/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

kirby-link-field
================

[](#kirby-link-field)

Kirby 3 Field for links of any kind - external, page, file, email, phone. Has settings for text, popup true/false, and hash. Original plugin is [this](https://github.com/medienbaecker/kirby-link-field), created by [Thomas Günther](https://github.com/medienbaecker).

The plugin uses the native Kirby fields for pages, files, url, email, and tel:

[![usage demo](usage.gif)](usage.gif)

If used inside a structure field, link fields get a nice preview. Links to pages and files get the native page/file preview:

[![links in structure field](structure.gif)](structure.gif)

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

[](#installation)

With [Composer](https://packagist.org/packages/oblik/kirby-link-field):

```
composer require oblik/kirby-link-field

```

...or check out [other plugin installation methods](https://getkirby.com/docs/guide/plugins/plugin-setup-basic#the-three-plugin-installation-methods).

Blueprint
---------

[](#blueprint)

Add a field and set its type to `link`:

```
fields:
  myfield:
    type: link
    label: Link
```

To define what link types you want, use `options`. Possible values are `url`, `page`, `file`, `email`, and `tel`:

```
fields:
  myfield:
    type: link
    label: Link
    options:
      - page
      - url
```

By default, you can also specify link text, popup true/false, and hash. You can disable those options or change their appearance by using the `settings` value:

```
fields:
  myfield:
    type: link
    label: Link
    settings:
      popup:
        width: 1/3
        label: External Link
        help: Open link in a new tab?
      text:
        width: 2/3
      hash: false
```

To disable settings altogether, set:

```
settings: false
```

You could also apply such settings globally:

*config/config.php*

```
return [
    'oblik.linkField' => [
        'options' => [
            'url',
            'page'
        ],
        'settings' => [
            'popup' => [
                'label' => 'External Link'
            ]
        ]
    ]
];
```

...or:

```
return [
    'oblik.linkField.settings' => false
];
```

### Pages/Files Settings

[](#pagesfiles-settings)

You could specify settings for the pages/files field. For example:

```
fields:
  myfield:
    type: link
    pages:
      query: page.siblings
      image:
        cover: true
    files:
      query: site.files
      text: '{{ file.id }}'
```

Usage
-----

[](#usage)

To render the links, use the provided `toLinkObject()` method. It returns an instance of the Link class.

Let's say you have a field with the following values:

```
Myfield:

type: page
value: home
text: My Text
popup: true
hash: heading-1

```

```
$link = $page->myfield()->toLinkObject();
```

### `$link->url()`

[](#link-url)

Returns the link URL, including the hash:

```
http://localhost/home#heading-1

```

**Note:** For `email` and `tel` links, the value is `null` since they're not actual links.

### `$link->href()`

[](#link-href)

Returns link href:

```
http://localhost/home#heading-1

```

If the link type is `email` or `tel`, it has `mailto:` or `tel:` accordingly.

**Note:** This is automatically called when you try to convert the class to string, meaning that:

```
echo $page->myfield()->toLinkObject();
```

...is the same as:

```
echo $page->myfield()->toLinkObject()->href();
```

### `$link->attr([$attributes])`

[](#link-attrattributes)

Returns the link attributes, merged with the optional `$attributes`:

```
href="http://localhost/home#heading-1" rel="noopener noreferrer" target="_blank"

```

### `$link->tag([$attributes])`

[](#link-tagattributes)

Returns a full `` tag with merged attributes from the optional `$attributes`:

```
My Text
```

### `$link->title()`

[](#link-title)

Returns either the link text, page title, file title, filename, or finally the value. Used to generate the link text for the `tag()` method.

### Retrieving Properties

[](#retrieving-properties)

You can get the properties of a link by invoking them as a method:

```
echo $link->type();     // page
echo $link->value();    // home
echo $link->text();     // My Text
echo $link->popup();    // true
echo $link->hash();     // heading-1
```

Migrating From URL Fields
-------------------------

[](#migrating-from-url-fields)

If you've previously used a URL field:

```
fields:
  myfield:
    type: url
```

...you could simply change it to:

```
fields:
  myfield:
    type: link
```

...and it'll work. Also, the `toLinkObject()` method can handle both link formats in your TXT files. It's the same if you have:

```
Myfield: https://example.com

```

...or:

```
Myfield:

type: url
value: https://example.com

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.1% 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 ~154 days

Total

3

Last Release

1386d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bde394e0ccb15aff412f2a35b6e2172cf88c7baea4e5e643e741f71ec19df7cc?d=identicon)[pstaender](/maintainers/pstaender)

---

Top Contributors

[![yandodov](https://avatars.githubusercontent.com/u/5570098?v=4)](https://github.com/yandodov "yandodov (68 commits)")[![medienbaecker](https://avatars.githubusercontent.com/u/7975568?v=4)](https://github.com/medienbaecker "medienbaecker (42 commits)")[![pstaender](https://avatars.githubusercontent.com/u/140571?v=4)](https://github.com/pstaender "pstaender (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![lukasleitsch](https://avatars.githubusercontent.com/u/3009245?v=4)](https://github.com/lukasleitsch "lukasleitsch (1 commits)")[![crealistiques](https://avatars.githubusercontent.com/u/6192571?v=4)](https://github.com/crealistiques "crealistiques (1 commits)")[![bvdputte](https://avatars.githubusercontent.com/u/490505?v=4)](https://github.com/bvdputte "bvdputte (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pstaender-kirby-uri-field/health.svg)

```
[![Health](https://phpackages.com/badges/pstaender-kirby-uri-field/health.svg)](https://phpackages.com/packages/pstaender-kirby-uri-field)
```

###  Alternatives

[getkirby/cms

The Kirby core

1.5k535.5k352](/packages/getkirby-cms)[distantnative/retour-for-kirby

Manage redirects and track 404s right from the Kirby CMS Panel

14689.4k1](/packages/distantnative-retour-for-kirby)[getkirby/staticache

Static site performance on demand

9615.4k](/packages/getkirby-staticache)[arnoson/kirby-vite

Vite helper for Kirby CMS

9759.2k3](/packages/arnoson-kirby-vite)[getkirby/kql

Kirby Query Language

15124.3k](/packages/getkirby-kql)[getkirby/starterkit

Kirby Starterkit

20612.3k](/packages/getkirby-starterkit)

PHPackages © 2026

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