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

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

fromholdio/silverstripe-externalurlfield
========================================

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

2.0.0(9mo ago)033.3k16MITPHP

Since Nov 19Pushed 9mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (4)Versions (20)Used By (6)

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

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

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)

Note - this is forked from [burnbright/silverstripe-externalurlfield](https://github.com/burnbright/silverstripe-externalurlfield).

```
composer require fromholdio/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 ^6

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 Fromholdio\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

47

—

FairBetter than 93% of packages

Maintenance57

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 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 ~264 days

Recently: every ~214 days

Total

16

Last Release

280d ago

Major Versions

0.3.2 → 1.0.02018-10-29

1.2.0 → 2.0.02025-09-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/40e135ad117686bee39707c1d9286cc5e915e219c26a10d13858ca44d14f1eb0?d=identicon)[dizzystuff](/maintainers/dizzystuff)

---

Top Contributors

[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (23 commits)")[![jedateach](https://avatars.githubusercontent.com/u/1356335?v=4)](https://github.com/jedateach "jedateach (22 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (5 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (3 commits)")

---

Tags

urllinksilverstripeformfield

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[burnbright/silverstripe-externalurlfield

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

109.6k1](/packages/burnbright-silverstripe-externalurlfield)[silverstripe/tagfield

Tag field for SilverStripe

561.3M50](/packages/silverstripe-tagfield)[lekoala/silverstripe-cms-actions

Add actions to your models in SilverStripe

39317.0k29](/packages/lekoala-silverstripe-cms-actions)[sheadawson/silverstripe-linkable

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

38317.5k24](/packages/sheadawson-silverstripe-linkable)

PHPackages © 2026

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