PHPackages                             oddvalue/link-builder - 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. oddvalue/link-builder

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

oddvalue/link-builder
=====================

Consistent interface for generating URLs and links for models

v2.0.0(8mo ago)13651MITPHPPHP ~8.2|~8.3|~8.4CI failing

Since Apr 20Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/oddvalue/link-builder)[ Packagist](https://packagist.org/packages/oddvalue/link-builder)[ Docs](https://github.com/oddvalue/link-builder)[ RSS](/packages/oddvalue-link-builder/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (6)Used By (1)

Link Builder
============

[](#link-builder)

A consistent interface for generating URLs and links for php models.

[![Latest Version on Packagist](https://camo.githubusercontent.com/d7c9bbe75046014d0be80595921192608f3639b19bf89ef508eb4905f8c22e15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f646476616c75652f6c696e6b2d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oddvalue/link-builder)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f0c54d2364ab25efc983837af3c377357614a3c7ea13c91aaf6d48b68cc1abc2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f646476616c75652f6c696e6b2d6275696c6465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/oddvalue/link-builder)[![Coverage Status](https://camo.githubusercontent.com/efa7dfd8236109e22ddf56102ae660ee9ab6d7f63686bec90f5e189f9f09ddab/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6f646476616c75652f6c696e6b2d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/oddvalue/link-builder/code-structure)[![Quality Score](https://camo.githubusercontent.com/f22464e5259a630d6dacd045fee015fb2579bc98e8d778ec4f9590ca43a6d9c1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6f646476616c75652f6c696e6b2d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/oddvalue/link-builder)[![Total Downloads](https://camo.githubusercontent.com/6499222747dcbbd92990af264ed6ad16e6476151ad5c38e3f094f4d94e9ee692/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f646476616c75652f6c696e6b2d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oddvalue/link-builder)

- [Installation](#Installation)
- [Usage](#Usage)
    - [Creating a Generator](#CreatingaGenerator)
    - [Preparing Your Model](#PreparingYourModel)
    - [Generating Links](#GeneratingLinks)
    - [Link Attributes](#LinkAttributes)

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

[](#installation)

Via Composer

```
$ composer require oddvalue/link-builder
```

Usage
--------------------------------------

[](#usage)

### Creating a Generator

[](#creating-a-generator)

First off you will need a generator class for your model. This generator class will be responsible for deciding what the href and label of the link for your model should be.

This is the minimum generator setup:

```
