PHPackages                             yard/acf-registrar - 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. yard/acf-registrar

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

yard/acf-registrar
==================

PHP package to register ACF Field Groups, Forms and Option Pages

v2.0.0(3mo ago)010↓50%[1 issues](https://github.com/yardinternet/wp-acf-registrar/issues)1MITPHPPHP &gt;=8.2CI passing

Since Aug 18Pushed 1w ago2 watchersCompare

[ Source](https://github.com/yardinternet/wp-acf-registrar)[ Packagist](https://packagist.org/packages/yard/acf-registrar)[ RSS](/packages/yard-acf-registrar/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (7)Versions (8)Used By (1)

ACF Registrar
=============

[](#acf-registrar)

[![Code Style](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/format-php.yml)[![PHPStan](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/phpstan.yml)[![Tests](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/run-tests.yml/badge.svg?no-cache)](https://github.com/yardinternet/wp-acf-registrar/actions/workflows/run-tests.yml)

Features
--------

[](#features)

- Register ACF Field groups
- Register ACF Forms
- Register ACF Option Pages

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

[](#installation)

This package can be installed using composer

```
composer require yard/acf-registrar
```

Usage
=====

[](#usage)

To use this package in a standard WordPress plugin, you can use the `Registrar` to register hooks.

main file:

```
/**
 * Plugin Name: My Plugin
 */

require __DIR__ . '/vendor/autoload.php';

$fieldGroups$ = [
    \Plugin\FieldGroupClass::class,
    \Plugin\AnotherFieldGroupClass::class,
];

$registrar = new \Yard\Acf\Registrar();
$registrar->addFieldGroups($fieldGroups);
$registrar->addForm(\Plugin\FormClass::class);
$registrar->addOptionPage(\Plugin\OptionPageClass::class);
$registrar->register();
```

FieldGroup Usage
----------------

[](#fieldgroup-usage)

Extend `Yard\Acf\Registar\FieldGroup` to define a field group. Add the class to `config/acf-registrar` in the `field_groups` key. See [Extended ACF](https://github.com/vinkla/extended-acf) for documentation about registering fields.

```
