PHPackages                             otago/autocomplete-suggest-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. otago/autocomplete-suggest-field

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

otago/autocomplete-suggest-field
================================

Autocomplete Suggestion Field

v6.2(2mo ago)89.7k↓29.2%4[1 issues](https://github.com/otago/autocomplete-suggest-field/issues)BSD-3-ClauseJavaScript

Since Jul 16Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/otago/autocomplete-suggest-field)[ Packagist](https://packagist.org/packages/otago/autocomplete-suggest-field)[ RSS](/packages/otago-autocomplete-suggest-field/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (2)Versions (19)Used By (0)

Auto-Complete Dropdown with Custom Data
=======================================

[](#auto-complete-dropdown-with-custom-data)

[![Autocomplete dropdown in action](docs/preview2.gif)](docs/preview2.gif)

Enhance your forms with a **dynamic auto-complete dropdown** that allows for custom data sources, making it easier to integrate external APIs or custom search methods.

Why Use This?
-------------

[](#why-use-this)

✅ **Flexible &amp; Powerful** – Works with `Varchar`, `Text`, `has_one`, and even `many_many` relationships.
✅ **Simple &amp; Clean** – Uses closures for a neat, efficient search method without complex controllers.
✅ **Customizable** – Supports external APIs, hardcoded arrays, and SilverStripe relationships.

Examples
--------

[](#examples)

Data must be returned in a 'value' 'label' key pair.

### Using an External API (e.g., Microsoft Graph)

[](#using-an-external-api-eg-microsoft-graph)

If you're fetching data from an external API, like Microsoft Graph, you can structure your search method as follows:

```
// 'Team' is a Varchar field in my DataObject.
$suggestedTeam = AutocompleteSuggestField::create('Team', 'Team', function ($search) {
    $result = AzureIntegration::request(
        "https://graph.microsoft.com/beta/groups?\$filter=startswith(displayName%2C'$search')&select=description,displayName,id&\$top=10",
        'GET'
    );

    $arrayList = [];
    foreach ($result->Data()?->value as $searchResult) {
        $arrayList[] = [
            'value' => $searchResult->id,
            'label' => $searchResult->displayName,
        ];
    }

    return $arrayList;
}, $this->Team, 'Name');

$fields->addFieldToTab('Root.Main', $suggestedTeam);
```

### Using a Hardcoded Array (e.g., has\_one Relationship)

[](#using-a-hardcoded-array-eg-has_one-relationship)

Need a simple dropdown with predefined options? This example saves against a `Member` has\_one relationship:

```
// 'Member' is a has_one relationship
$favoriteMember = AutocompleteSuggestField::create('MemberID', 'Favorite Member', function ($search) {
    return [
        [ 'value' => 1, 'label' => 'Torleif'],
        [ 'value' => 80, 'label' => 'Alastair'],
    ];
});
```

### Using a many\_many Relationship

[](#using-a-many_many-relationship)

Want multi-selection? This works with `many_many` relationships using `setIsMultiple(true)`, allowing multiple selections.

```
$myTeam = AutocompleteSuggestField::create('Members', 'Members', function ($search) {
    return [
        [ 'value' => 1, 'label' => 'Bobby Lee'],
        [ 'value' => 80, 'label' => 'Van Halen'],
    ];
}, $this->Members())->setIsMultiple(true);
```

---

Compatibility
-------------

[](#compatibility)

- **SilverStripe 5+** – Use this package for the latest version.
- **SilverStripe 4.\*** – Use version `4.0`.
- **SilverStripe 3.\*** – Use version `3.0`.

For DataObjects in SilverStripe 5.2+, consider using the built-in [`SearchableDropdownField`](https://docs.silverstripe.org/en/5/changelogs/5.2.0/#searchable-dropdown-field) for simpler internal searches.

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

[](#installation)

Install via Composer:

```
composer require otago/autocomplete-suggest-field
```

Features
--------

[](#features)

- **Custom Autocomplete** – Define what data appears in the dropdown.
- **User-Friendly Labels** – Display meaningful names instead of raw database IDs.
- **CMS-Friendly** – Keeps your admin panel clean and intuitive.

Running Tests
-------------

[](#running-tests)

Ensure everything works correctly with:

```
vendor/silverstripe/framework/sake dev/tests/AutocompleteSuggestTest
```

---

Now you're all set to implement a **powerful and flexible** autocomplete dropdown in your SilverStripe project! 🚀

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% 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 ~167 days

Recently: every ~106 days

Total

18

Last Release

66d ago

Major Versions

v3.0 → 4.02018-07-16

4.11.0 → 5.02024-08-06

5.3.1 → v6.02026-01-25

### Community

Maintainers

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

---

Top Contributors

[![torleif](https://avatars.githubusercontent.com/u/67215?v=4)](https://github.com/torleif "torleif (43 commits)")[![nyeholt](https://avatars.githubusercontent.com/u/161730?v=4)](https://github.com/nyeholt "nyeholt (1 commits)")[![rasstislav](https://avatars.githubusercontent.com/u/9253113?v=4)](https://github.com/rasstislav "rasstislav (1 commits)")[![zoaina](https://avatars.githubusercontent.com/u/6291804?v=4)](https://github.com/zoaina "zoaina (1 commits)")

---

Tags

silverstripe

### Embed Badge

![Health badge](/badges/otago-autocomplete-suggest-field/health.svg)

```
[![Health](https://phpackages.com/badges/otago-autocomplete-suggest-field/health.svg)](https://phpackages.com/packages/otago-autocomplete-suggest-field)
```

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-gridfieldextensions

A collection of useful grid field components

951.9M272](/packages/symbiote-silverstripe-gridfieldextensions)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[silverstripe/tagfield

Tag field for SilverStripe

561.3M50](/packages/silverstripe-tagfield)[jonom/silverstripe-betternavigator

Front-end utility menu for Silverstripe websites featuring administration and development tools

60435.1k13](/packages/jonom-silverstripe-betternavigator)[lekoala/silverstripe-cms-actions

Add actions to your models in SilverStripe

39344.8k31](/packages/lekoala-silverstripe-cms-actions)

PHPackages © 2026

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