PHPackages                             tombroucke/acf-objects - 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. tombroucke/acf-objects

ActivePackage[Utility &amp; Helpers](/categories/utility)

tombroucke/acf-objects
======================

Convert return values from get\_field() to objects with easy-to-use methods

4.2.5(1y ago)67.1k↓53.3%23MITPHPPHP ^8.0CI failing

Since Sep 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tombroucke/acf-objects)[ Packagist](https://packagist.org/packages/tombroucke/acf-objects)[ RSS](/packages/tombroucke-acf-objects/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (49)Used By (3)

ACF Objects
===========

[](#acf-objects)

This package converts the return values of ACF to objects with easy-to-use methods.

Instead of calling `get_field('selector')`, you can use the AcfObjects facade: `AcfObjects::getField('selector')`

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

[](#installation)

`composer require tombroucke/acf-objects`

You might have to clear wp acorn cache: `wp acorn optimize:clear`

Usage
-----

[](#usage)

### Checkbox

[](#checkbox)

When getting the value for a Checkbox field, an `Illuminate/Support/Collection` will be returned.

```
$checkboxValues = AcfObjects::getField('checkbox');
```

### ColorPicker

[](#colorpicker)

```
{{ AcfObjects::getField('color_picker') }}
```

### DatePicker

[](#datepicker)

When getting the value for a DatePicker field, a `Carbon` instance will be returned. If the field has no value, a `FallbackField` will be returned.

```
AcfObjects::getField('date')
```

```
@if(AcfObjects::getField('date')->isSet())
  AcfObjects::getField('date')->format(get_option('date_format))
@endif
```

### DateTimePicker

[](#datetimepicker)

When getting the value for a DateTimePicker field, a `Carbon` instance will be returned. If the field has no value, a `FallbackField` will be returned.

```
AcfObjects::getField('date_time')
```

### Email

[](#email)

```
{{ AcfObjects::getField('email')->obfuscate() }}
```

### File

[](#file)

```
{{ AcfObjects::getField('file')->url() }}
{{ AcfObjects::getField('file')->title() }}
{{ AcfObjects::getField('file')->filesize() }}
```

### Gallery

[](#gallery)

When getting the value for a Group field, an `Illuminate/Support/Collection` will be returned.

```
@foreach (AcfObjects::getField('gallery') as $image)

    {!! $image->image('medium') !!}

@endforeach
```

### Google Maps

[](#google-maps)

```
{{ AcfObjects::getField('google_map')->address() }}
{{ AcfObjects::getField('google_map')->lat() }}
{{ AcfObjects::getField('google_map')->long() }}
```

### Group

[](#group)

```
  $settings = AcfObjects::getField('settings')
    ->default([
      'foo' => 'bar'
    ]);

  echo $settings->get('foo');
```

```
{{ AcfObjects::getField('settings')->get('name') }}
```

### Image

[](#image)

```
{!!
AcfObjects::getField('image')
  ->url('medium');
!!}

{!!
AcfObjects::getField('image')
  ->attributes(['class' => 'w-100 h-100 object-fit-cover'])
  ->image('thumbnail');
!!}

{!!
AcfObjects::getField('image')
  ->default(asset('image/placeholder.jpg')->uri())
  ->image('thumbnail');
!!}
```

### Link

[](#link)

```
{{ AcfObjects::getField('link')->url() }}

@php
  $link = AcfObjects::getField('link');
@endphp

@if($link->isSet())

      {{ $link->title() }}

@endif

// or

@if($link->isSet())
  {!! $link->link() !!}
@endif
```

### Number

[](#number)

```
{{ AcfObjects::getField('number') }}
```

### Repeater

[](#repeater)

When getting the value for a Repeater field, an `Illuminate/Support/Collection` will be returned.

```
AcfObjects::getField('repeater')
```

```
@unless(AcfObjects::getField('repeater')->isEmpty())

  @foreach(AcfObjects::getField('repeater') as $item)
    {!! $item['name'] !!}
  @endforeach

@endunless
```

### Text

[](#text)

```
{{ AcfObjects::getField('text')->default(get_the_title()) }}
```

### TextArea

[](#textarea)

```
{{ AcfObjects::getField('text_area') }}
```

Upgrading to v4.x from v3.x
---------------------------

[](#upgrading-to-v4x-from-v3x)

### Use new facade

[](#use-new-facade)

```
- Acf::getField(
+ AcfObjects::getField(
```

### Use new facade and remove deprecated get\_field method

[](#use-new-facade-and-remove-deprecated-get_field-method)

```
- Acf::get_field(
+ AcfObjects::getField(
```

### Use new facade

[](#use-new-facade-1)

```
- use Otomaties\AcfObjects\Acf;
+ use Otomaties\AcfObjects\Facades\AcfObjects;
```

### Array access for repeaters instead of the `get()` method.

[](#array-access-for-repeaters-instead-of-the-get-method)

```
- $repeater->get('sub_field')
+ $repeater['sub_field']
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance49

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~37 days

Recently: every ~50 days

Total

48

Last Release

369d ago

Major Versions

1.1.2 → 2.0.02020-12-14

2.2.4 → 3.0.02022-05-12

3.10.0 → 4.0.02024-10-14

PHP version history (2 changes)3.0.0PHP &gt;=8

4.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4178291ccf36e3530aa8a8845124c3af1b24c064739ad98ded5b9679a4316033?d=identicon)[tombroucke](/maintainers/tombroucke)

---

Top Contributors

[![tombroucke](https://avatars.githubusercontent.com/u/24292260?v=4)](https://github.com/tombroucke "tombroucke (78 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tombroucke-acf-objects/health.svg)

```
[![Health](https://phpackages.com/badges/tombroucke-acf-objects/health.svg)](https://phpackages.com/packages/tombroucke-acf-objects)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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