PHPackages                             fof/links - 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. fof/links

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

fof/links
=========

Manage Flarum primary navbar menu links

1.4.0(7mo ago)39118.3k—1.9%122MITPHPPHP ^8.0CI passing

Since Jan 6Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/FriendsOfFlarum/links)[ Packagist](https://packagist.org/packages/fof/links)[ Docs](https://friendsofflarum.org)[ Fund](https://opencollective.com/fof/donate)[ RSS](/packages/fof-links/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (35)Used By (2)

FoF Links
=========

[](#fof-links)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/973ff5dbcbc109350a21ff6cc5274d35a2e65bb6c9bd3dba19a68851813d3b03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f662f6c696e6b732e737667)](https://packagist.org/packages/fof/links) [![Total Downloads](https://camo.githubusercontent.com/967a4c344397df164f615306f76f58729e302b425ecc39f77b5c06c930cbe010/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f662f6c696e6b732e737667)](https://packagist.org/packages/fof/links)

A [Flarum](http://flarum.org) extension that allows you to add links to your forum's navigation.

Features
--------

[](#features)

- Add links to your forum's navigation menu
- Support for both internal and external links
- Control link visibility based on user groups
- Guest-only links
- Hierarchical links (dropdown menus)
- Programmatic link definition via PHP

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

[](#installation)

Install with composer:

```
composer require fof/links
```

Updating
--------

[](#updating)

```
composer update fof/links
php flarum cache:clear
```

Usage
-----

[](#usage)

### Admin Interface

[](#admin-interface)

Links can be managed through the admin interface under the "Links" tab.

### Programmatic Link Definition

[](#programmatic-link-definition)

This extension provides a way to define links programmatically through PHP code. This can be useful in situations where there are multiple environments (ie dev, staging, production) and you want to define a set of links only once (in code), and not have to re-enter or define them via the admin interface.

#### Basic Usage

[](#basic-usage)

```
use FoF\Links\Extend\LinksOverride;
use FoF\Links\LinkDefinition;

return [
    // Other extenders...

    (new LinksOverride())
        ->addLinks([
            LinkDefinition::make()
                ->withId(1)
                ->withTranslationKey('my-extension.link')
                ->withUrl('/my-page')
                ->withIcon('fas fa-link')
                ->withIsInternal(true)
        ])
];
```

#### Hierarchical Links

[](#hierarchical-links)

You can create dropdown menus by adding child links:

```
use FoF\Links\Extend\LinksOverride;
use FoF\Links\LinkDefinition;

$parent = LinkDefinition::make()
    ->withId(1)
    ->withTranslationKey('my-extension.parent')
    ->withUrl('/parent');

$child1 = LinkDefinition::make()
    ->withId(2)
    ->withTranslationKey('my-extension.child1')
    ->withUrl('/child1');

$child2 = LinkDefinition::make()
    ->withId(3)
    ->withTranslationKey('my-extension.child2')
    ->withUrl('/child2');

$parent->addChild($child1);
$parent->addChild($child2);

return [
    // Other extenders...

    (new LinksOverride())
        ->addLinks([$parent])
];
```

#### Using a Provider Class

[](#using-a-provider-class)

For more complex scenarios, you can use a provider class:

```
use FoF\Links\Extend\LinksOverride;
use FoF\Links\LinkDefinition;

class MyLinksProvider
{
    public function __invoke()
    {
        return [
            LinkDefinition::make()
                ->withId(1)
                ->withTranslationKey('my-extension.link')
                ->withUrl('/my-page')
        ];
    }
}

return [
    // Other extenders...

    (new LinksOverride())
        ->addLinks(MyLinksProvider::class)
];
```

### LinkDefinition API

[](#linkdefinition-api)

The `LinkDefinition` class provides a fluent interface for defining links:

MethodDescription`withId(int $id)`Set the link ID`withTranslationKey(string $key)`Set the translation key for the link title`withUrl(string $url)`Set the link URL`withIcon(string $icon)`Set the link icon (FontAwesome class)`withIsInternal(bool $isInternal)`Set whether the link is internal`withIsNewtab(bool $isNewtab)`Set whether the link should open in a new tab`withUseRelme(bool $useRelme)`Set whether to use rel="me" attribute`withGuestOnly(bool $guestOnly)`Set whether the link is only visible to guests`withParentId(?int $parentId)`Set the parent link ID`withPosition(int $position)`Set the link position`addChild(LinkDefinition $child)`Add a child linkLinks
-----

[](#links)

- [Packagist](https://packagist.org/packages/fof/links)
- [GitHub](https://github.com/FriendsOfFlarum/links)
- [Discuss](https://discuss.flarum.org/d/18335)

An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum).

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance74

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~81 days

Recently: every ~32 days

Total

33

Last Release

92d ago

Major Versions

0.6.0 → 1.0.02021-05-17

1.4.0 → 2.0.0-beta.12025-11-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16573496?v=4)[IanM](/maintainers/imorland)[@imorland](https://github.com/imorland)

![](https://avatars.githubusercontent.com/u/1630413?v=4)[Gregor Hammerschmidt](/maintainers/GreXXL)[@GreXXL](https://github.com/GreXXL)

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

![](https://www.gravatar.com/avatar/1298cdc0b2402a1aa34fb75a254947d655e090d62bd0531311331d369cac934e?d=identicon)[datitisev](/maintainers/datitisev)

---

Top Contributors

[![imorland](https://avatars.githubusercontent.com/u/16573496?v=4)](https://github.com/imorland "imorland (32 commits)")[![flarum-bot](https://avatars.githubusercontent.com/u/39334649?v=4)](https://github.com/flarum-bot "flarum-bot (28 commits)")[![dsevillamartin](https://avatars.githubusercontent.com/u/6401250?v=4)](https://github.com/dsevillamartin "dsevillamartin (17 commits)")[![davwheat](https://avatars.githubusercontent.com/u/7406822?v=4)](https://github.com/davwheat "davwheat (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![karaok491](https://avatars.githubusercontent.com/u/72854852?v=4)](https://github.com/karaok491 "karaok491 (9 commits)")[![luceos](https://avatars.githubusercontent.com/u/504687?v=4)](https://github.com/luceos "luceos (3 commits)")[![SychO9](https://avatars.githubusercontent.com/u/20267363?v=4)](https://github.com/SychO9 "SychO9 (2 commits)")[![iPurpl3x](https://avatars.githubusercontent.com/u/18526076?v=4)](https://github.com/iPurpl3x "iPurpl3x (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![clarkwinkelmann](https://avatars.githubusercontent.com/u/5264300?v=4)](https://github.com/clarkwinkelmann "clarkwinkelmann (1 commits)")[![rob006](https://avatars.githubusercontent.com/u/5972388?v=4)](https://github.com/rob006 "rob006 (1 commits)")[![askvortsov1](https://avatars.githubusercontent.com/u/38059171?v=4)](https://github.com/askvortsov1 "askvortsov1 (1 commits)")[![jaggy](https://avatars.githubusercontent.com/u/1993075?v=4)](https://github.com/jaggy "jaggy (1 commits)")

---

Tags

flarumfriendsofflarumhacktoberfestflarum

### Embed Badge

![Health badge](/badges/fof-links/health.svg)

```
[![Health](https://phpackages.com/badges/fof-links/health.svg)](https://phpackages.com/packages/fof-links)
```

###  Alternatives

[fof/byobu

Well integrated, advanced private discussions.

61105.8k9](/packages/fof-byobu)[fof/user-bio

Add a user bio to user profiles

2196.5k9](/packages/fof-user-bio)[fof/drafts

Allow users to create post and discussion drafts

1771.1k5](/packages/fof-drafts)[fof/nightmode

Add a Night Mode option for your users to use on your Flarum forum

3774.5k2](/packages/fof-nightmode)[fof/best-answer

Mark a post as the best answer in a discussion

26135.2k15](/packages/fof-best-answer)[fof/polls

 A Flarum extension that adds polls to your discussions

25122.4k9](/packages/fof-polls)

PHPackages © 2026

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