PHPackages                             marionnewlevant/agnostic-fetch - 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. marionnewlevant/agnostic-fetch

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

marionnewlevant/agnostic-fetch
==============================

uniform syntax for fetching elements whether or not they have been eager loaded

2.0.4(7y ago)613.9k—0%3[3 issues](https://github.com/marionnewlevant/craft-agnostic_fetch/issues)MITPHP

Since Feb 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/marionnewlevant/craft-agnostic_fetch)[ Packagist](https://packagist.org/packages/marionnewlevant/agnostic-fetch)[ RSS](/packages/marionnewlevant-agnostic-fetch/feed)WikiDiscussions v2 Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (7)Used By (0)

Agnostic Fetch plugin for Craft CMS 3.x
=======================================

[](#agnostic-fetch-plugin-for-craft-cms-3x)

Craft plugin that provides uniform syntax for fetching elements whether or not they have been eager loaded

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

[](#installation)

To install Agnostic Fetch, follow these steps:

1. Download &amp; unzip the file, rename the unzipped folder to `agnosticfetch` and place the `agnosticfetch` folder into your `craft/plugins` folder
2. -OR- do a `git clone https://github.com/marionnewlevant/craft3-agnositic_fetch.git` directly into your `craft/plugins` folder, and rename to `agnosticfetch`. You can then update it with `git pull`
3. -OR- install with Composer via `composer require marionnewlevant/agnostic-fetch` from your project folder
4. Install plugin in the Craft Control Panel under Settings &gt; Plugins
5. The plugin folder should be named `agnosticfetch` for Craft to see it.

Agnostic Fetch works on Craft 3.x.

Agnostic Fetch Overview
-----------------------

[](#agnostic-fetch-overview)

The code to fetch the elements from a Craft Element Query is different when the elements have been [eager-loaded](https://craftcms.com/docs/templating/eager-loading-elements). For example, to get the first element of a non eagerly loaded field, `someField.one()`, but for an eagerly loaded field, `someField[0]` (and that doesn't even get into the error checking). With Agnostic Fetch, you can do `someField | one` (or `one(someField)` or `craft.agnosticfetch.one(someField)`).

The Agnostic Fetch functions are available as twig filters, as twig functions, and as craft variables.

Using Agnostic Fetch
--------------------

[](#using-agnostic-fetch)

### all

[](#all)

Use any of:

- someField | all
- all(someField)
- craft.agnosticfetch.all(someField)

### one

[](#one)

Use any of:

- someField | one
- one(someField)
- craft.agnosticfetch.one(someField)

### nth

[](#nth)

Use any of:

- someField | nth(index)
- nth(someField, index)
- craft.agnosticfetch.nth(someField, index)

(index is based from `0`)

### ids

[](#ids)

Use any of:

- someField | ids
- ids(someField)
- craft.agnosticfetch.ids(someField)

### count

[](#count)

Use any of:

- someField | count
- count(someField)
- craft.agnosticfetch.count(someField)

### isEager

[](#iseager)

In addition to the fetching functions, `isEager` will tell you whether elements have been eager loaded or not.

Use any of:

- someField | isEager
- isEager(someField)
- craft.agnosticfetch.isEager(someField)

Brought to you by [Marion Newlevant](http://marion.newlevant.com)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 76.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 ~121 days

Recently: every ~90 days

Total

7

Last Release

2655d ago

Major Versions

1.0.0 → 2.0.02017-10-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/695477?v=4)[Marion Newlevant](/maintainers/marionnewlevant)[@marionnewlevant](https://github.com/marionnewlevant)

---

Top Contributors

[![marionnewlevant](https://avatars.githubusercontent.com/u/695477?v=4)](https://github.com/marionnewlevant "marionnewlevant (13 commits)")[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (3 commits)")[![bossanova808](https://avatars.githubusercontent.com/u/731309?v=4)](https://github.com/bossanova808 "bossanova808 (1 commits)")

---

Tags

Craftcraftcmscraft-plugineageragnostic-fetch

### Embed Badge

![Health badge](/badges/marionnewlevant-agnostic-fetch/health.svg)

```
[![Health](https://phpackages.com/badges/marionnewlevant-agnostic-fetch/health.svg)](https://phpackages.com/packages/marionnewlevant-agnostic-fetch)
```

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[verbb/vizy

A flexible visual editor field for Craft.

4348.6k](/packages/verbb-vizy)

PHPackages © 2026

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