PHPackages                             burnbright/silverstripe-externalurlfield - 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. burnbright/silverstripe-externalurlfield

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

burnbright/silverstripe-externalurlfield
========================================

Provides SilverStripe with a DBField and FormField for handling external URLs.

0.3.2(9y ago)109.6k11[5 issues](https://github.com/burnbright/silverstripe-externalurlfield/issues)[5 PRs](https://github.com/burnbright/silverstripe-externalurlfield/pulls)1MITPHPCI failing

Since Nov 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/burnbright/silverstripe-externalurlfield)[ Packagist](https://packagist.org/packages/burnbright/silverstripe-externalurlfield)[ RSS](/packages/burnbright-silverstripe-externalurlfield/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (7)Used By (1)

SilverStripe External URL Field
===============================

[](#silverstripe-external-url-field)

[![Build Status](https://camo.githubusercontent.com/cc4ae1b39d612c6badd10b06b328f279a83a373fe94a4a47acee1321ecb9242c/68747470733a2f2f7472617669732d63692e6f72672f6275726e6272696768742f73696c7665727374726970652d65787465726e616c75726c6669656c642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/burnbright/silverstripe-externalurlfield) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/c6ce3138d98492d42b24743b69d0127e54817dfee9d0a137f424e60c58161f1c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6275726e6272696768742f73696c7665727374726970652d65787465726e616c75726c6669656c642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/burnbright/silverstripe-externalurlfield/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/e52de42d958ff018cffb5147c80d21b8ed020e113056291c007de5bf434db028/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6275726e6272696768742f73696c7665727374726970652d65787465726e616c75726c6669656c642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/burnbright/silverstripe-externalurlfield/?branch=master)

Provides a `DBField` and `FormField` for handling external URLs.

Validate and tidy urls as they are captured from users. Configuration is highly flexible. Makes use of php's `parse_url` and `http_build_url` to do the actual work.

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

[](#installation)

```
composer require burnbright/silverstripe-externalurlfield "*@stable"
```

Requirements
------------

[](#requirements)

Makes use of the `http_build_url` function from the [PECL pecl\_http library](http://php.net/manual/en/ref.http.php). However the module's composer requirements include a [PHP fallback/shim/polyfill](https://github.com/jakeasmith/http_build_url). The composer replacement does check for the presence of `http_build_url`.

- SilverStripe ^4

DataObject / Template Usage
---------------------------

[](#dataobject--template-usage)

Handled by `ExternalURL` class (Varchar).

```
use SilverStripe\ORM\DataObject;

class MyDataObject extends DataObject
{
    private static $db = array(
        'Website' => 'ExternalURL'
    );
}
```

```

    Website: $Website
    Website Nice: $Website.Nice
    Website Domain: $Website.Domain
    Website Domain No WWW: $Website.Domain.NoWWW

```

Given the url `http://username:password@www.hostname.com:81/path?arg=value#anchor`, the above produces:

```
Website: http://username:password@www.hostname.com:81/path?arg=value#anchor
Website Nice: www.hostname.com/path
Website Domain: www.hostname.com
Website Domain No WWW: hostname.com

```

Form Usage
----------

[](#form-usage)

Handled by `ExternalURLField` (FormField).

Validation is handled by the html5 pattern attribute, and also server side by [a more robust regular expression](https://gist.github.com/dperini/729294). The field uses the html5 `type="url"` attribute.

You can configure various parts of the url to be stripped out, or populated with defaults when missing.

```
use BurnBright\ExternalURLField\ExternalURLField;

//default
$websitefield = new ExternalURLField('Website');

//set options (with defaults shown)
$websitefield->setConfig(array(
    //these will be added, if missing
    'defaultparts' => array(
        'scheme' => 'http'
    ),
    //these parts are removed from saved urls
    'removeparts' => array(
        'scheme' => false,
        'user' => true,
        'pass' => true,
        'host' => false,
        'port' => false,
        'path' => false,
        'query' => false,
        'fragment' => false
    ),
    'html5validation' => true
));

//say you want to store nice tidy facebook urls
$websitefield->setConfig('removeparts',array(
    'query' => true,
    'fragment' => 'true',
    'port' => 'true'
));
//a urls like https://www.facebook.com/joe.bloggs?fref=nf&pnref=story
//would become https://www.facebook.com/joe.bloggs
```

### HTML5 validation

[](#html5-validation)

Enabled by default, the html5 validation sets the field type atribute to `url`, and adds a pattern attribute which is set to `https?://.+`.

Disable using the `html5validation` config:

```
$field->setConfig("html5validation", false);
```

Disabling html5 validation is particularly useful if you want to allow users to enter urls that have no scheme/protocol e.g: `mywebsite.com` instead of `http://www.mywebsite.com`.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.6% 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 ~132 days

Recently: every ~166 days

Total

6

Last Release

3536d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1356335?v=4)[Jeremy Shipman](/maintainers/jedateach)[@jedateach](https://github.com/jedateach)

---

Top Contributors

[![jedateach](https://avatars.githubusercontent.com/u/1356335?v=4)](https://github.com/jedateach "jedateach (23 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (9 commits)")[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (2 commits)")

---

Tags

maintainer-wantedurllinksilverstripeformfield

### Embed Badge

![Health badge](/badges/burnbright-silverstripe-externalurlfield/health.svg)

```
[![Health](https://phpackages.com/badges/burnbright-silverstripe-externalurlfield/health.svg)](https://phpackages.com/packages/burnbright-silverstripe-externalurlfield)
```

###  Alternatives

[silverstripe/tagfield

Tag field for SilverStripe

571.2M45](/packages/silverstripe-tagfield)[sheadawson/silverstripe-linkable

A couple of handy form fields and objects for managing external and internal links on DataObjects

39316.2k24](/packages/sheadawson-silverstripe-linkable)[kinglozzer/multiselectfield

A sortable multiple select field for managing many-to-many relations

1341.2k2](/packages/kinglozzer-multiselectfield)[adrhumphreys/silverstripe-textdropdownfield

A text field combined with a dropdown field.

106.1k](/packages/adrhumphreys-silverstripe-textdropdownfield)

PHPackages © 2026

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