PHPackages                             silverstripe/segment-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. silverstripe/segment-field

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

silverstripe/segment-field
==========================

A reusable approach to segment-generating fields

4.0.4(3mo ago)71.0M↓10.3%15[3 PRs](https://github.com/silverstripe/silverstripe-segment-field/pulls)6MITPHPPHP ^8.3CI passing

Since Aug 11Pushed 1mo ago9 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (82)Used By (6)

Silverstripe Segment Field
==========================

[](#silverstripe-segment-field)

[![CI](https://github.com/silverstripe/silverstripe-segment-field/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-segment-field/actions/workflows/ci.yml)[![Silverstripe supported module](https://camo.githubusercontent.com/9b7e93d393a01f6d3091fb30983b870aa863ef076858115faaa1c74b995854ec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73696c7665727374726970652d737570706f727465642d3030373143342e737667)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)

A reusable approach to segment-generating fields.

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

[](#installation)

```
composer require silverstripe/segment-field
```

Usage
-----

[](#usage)

```
use SilverStripe\Forms\SegmentField;
use SilverStripe\Forms\SegmentFieldModifier\SlugSegmentFieldModifier;
use SilverStripe\Forms\SegmentFieldModifier\IDSegmentFieldModifier;

SegmentField::create('PageName')->setModifiers(array(
    SlugSegmentFieldModifier::create()->setDefault('page'),
    array('-', ''),
    IDSegmentFieldModifier::create(),
))->setPreview($this->PageDisplayName)
```

1. Starting with a value of `"My New Page!"`.
2. The value is passed through `SlugSegmentFieldModifier`.
3. Preview value becomes `"My-New-Page"`, Input value becomes `"My-New-Page"`.
4. The value is passed through `array('-', '')`.
5. Preview value becomes `"My-New-Page-"`, Input value becomes `"My-New-Page"`.
6. The value is passed through `IDSegmentFieldModifier`.
7. Preview value becomes `"My-New-Page-1"` (with the DataObject ID), Input value becomes `"My-New-Page"`.

You can pass any similarly structured array or implementation of `SilverStripe\Forms\SegmentFieldModifier` in the modifiers list.

Using on the frontend
---------------------

[](#using-on-the-frontend)

This field is primarily designed for use within the Silverstripe CMS. If you want to use it on the frontend, please ensure that you have included your own version of jQuery and the jQuery entwine library that ships with the silverstripe/admin module, for example:

```
Requirements::javascript('//code.jquery.com/jquery-3.3.1.min.js');
Requirements::javascript('silverstripe/admin:thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
```

These dependencies are included by default when using this field within the CMS.

Versioning
----------

[](#versioning)

This library follows [Semver](http://semver.org). According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with `public` visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep `protected` methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Thanks
------

[](#thanks)

I'd like to thank [SilverStripe](http://www.silverstripe.com) for letting me work on fun projects like this. Feel free to talk to me about using the [framework and CMS](http://www.silverstripe.org) or [working at SilverStripe](http://www.silverstripe.com/who-we-are/#careers).

###  Health Score

68

—

FairBetter than 100% of packages

Maintenance85

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

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

Recently: every ~0 days

Total

76

Last Release

98d ago

Major Versions

2.x-dev → 3.2.22024-07-22

3.3.0-rc1 → 4.0.0-alpha12024-11-20

3.2.x-dev → 4.0.02025-06-05

3.3.1 → 4.0.12025-08-18

3.x-dev → 4.0.42026-02-10

PHP version history (4 changes)2.5.0PHP ^7.3 || ^8.0

2.6.0PHP ^7.4 || ^8.0

3.0.0-beta1PHP ^8.1

4.0.0-alpha1PHP ^8.3

### Community

Maintainers

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

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

![](https://www.gravatar.com/avatar/afbb3dcc9ef29c1a6eedd6addcae5fce9ab1271915a85a4c349301b71237368d?d=identicon)[silverstripe-machine01](/maintainers/silverstripe-machine01)

![](https://avatars.githubusercontent.com/u/1168676?v=4)[Maxime Rainville](/maintainers/maxime-rainville)[@maxime-rainville](https://github.com/maxime-rainville)

---

Top Contributors

[![emteknetnz](https://avatars.githubusercontent.com/u/4809037?v=4)](https://github.com/emteknetnz "emteknetnz (59 commits)")[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (52 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (45 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (30 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (26 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (15 commits)")[![NightJar](https://avatars.githubusercontent.com/u/778003?v=4)](https://github.com/NightJar "NightJar (4 commits)")[![sabina-talipova](https://avatars.githubusercontent.com/u/87288324?v=4)](https://github.com/sabina-talipova "sabina-talipova (3 commits)")[![dnsl48](https://avatars.githubusercontent.com/u/9313746?v=4)](https://github.com/dnsl48 "dnsl48 (2 commits)")[![maxime-rainville](https://avatars.githubusercontent.com/u/1168676?v=4)](https://github.com/maxime-rainville "maxime-rainville (2 commits)")[![adamjudd](https://avatars.githubusercontent.com/u/287335?v=4)](https://github.com/adamjudd "adamjudd (2 commits)")[![Cambis](https://avatars.githubusercontent.com/u/12287346?v=4)](https://github.com/Cambis "Cambis (1 commits)")[![raissanorth](https://avatars.githubusercontent.com/u/14869519?v=4)](https://github.com/raissanorth "raissanorth (1 commits)")[![bergice](https://avatars.githubusercontent.com/u/541886?v=4)](https://github.com/bergice "bergice (1 commits)")

---

Tags

cmshacktoberfestsilverstripesilverstripesegment

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/silverstripe-segment-field/health.svg)

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

PHPackages © 2026

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