# Advanced Custom Fields with composer

**URL:** https://discourse.roots.io/t/advanced-custom-fields-with-composer/10109
**Category:** plugins
**Created:** 2017-08-01T15:06:13Z
**Posts:** 11

## Post 1 by @mellis84 — 2017-08-01T15:06:13Z

HI Guys!

Very new to Sage so i apologise, I have edited my composer.json file to have the following:

 ![57](https://discourse.roots.io/uploads/default/original/2X/6/6671b9fd2005ad6998c95691b06f71c24bd2264e.png)

And when I run a composer update , the wp-content folder pops into the Root dir:

 ![35](https://discourse.roots.io/uploads/default/original/2X/5/5a64cc74040f093098e7c6626518c63e23ab8a84.png)

Is this right? When I go into the wp-admin I can’t find it.

Can some one help me out? I also tried adding in a setting for it in my `app/helpers.php` with the following:  
`//add_filter('wp-content/plugins/advanced-custom-fields/settings/show_admin', '__return_false');`  
So i can hide it in the admin when I want to put it live…

---

## Post 2 by @strarsis — 2017-08-01T16:32:34Z

You want to install ACF free or PRO?

For using wpackagist repository you just have to declare it once,  
then you can require with the `wpackagist-plugin/` prefix.

For ACF free (wpackagist):

```
{
  [...]
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    [...]
    "wpackagist-plugin/advanced-custom-fields": "4.4.11"
  }
}
```

---

## Post 3 by @ben — 2017-08-01T19:35:37Z

You can’t use the `composer.json` file in the theme for this. You need to use something like Bedrock if you want to manage WordPress plugins via Composer

> **[Bedrock | WordPress Boilerplate | Roots](https://roots.io/bedrock/)**
>
> The best way to start a WordPress project. WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure.

---

## Post 4 by @alwaysblank — 2017-08-01T20:06:25Z

If you need something like ACF and are insistent on it being a theme dependency, [Carbon Fields](https://carbonfields.net/) offers a lot of the same functionality and can be included through your theme’s `composer.json`.

See: [https://carbonfields.net/docs/carbon-fields-quickstart/](https://carbonfields.net/docs/carbon-fields-quickstart/)

---

## Post 5 by @mellis84 — 2017-08-01T21:13:38Z

Thanks for all your help guys! will work in the Bedrock install :slight_smile:

---

## Post 6 by @treb0r — 2017-08-02T14:44:34Z

Carbon Fields looks great, are you using it?

Tempted to switch from ACF.

---

## Post 7 by @alwaysblank — 2017-08-02T15:55:47Z

I used it on a couple projects, although I’ve gone back to using ACF lately, partly because it’s what everyone else at the agency where I work uses. It works on a slightly different paradigm, and isn’t quite as “plug-and-play” as ACF, but it’s very flexible and pretty nice to work with once you get the hang of it. The biggest thing I missed from ACF when I was using it was “flexible” fields, which it didn’t really have an analog for at the time. I’d recommend checking it out, though.

---

## Post 8 by @treb0r — 2017-08-03T09:26:42Z

> [@alwaysblank](#):
>
> The biggest thing I missed from ACF when I was using it was “flexible” fields, which it didn’t really have an analog for at the time.

Yeah, I’ve used the ACF flexible fields a few times but have gone off using them now.

I decided that the main content is best off stored in the content field as much as possible. For now I’m keeping things simple.

I do use repeater fields occasionally but seeing as Carbon has those, I’m going to dive in.

---

## Post 9 by @bobz_zg — 2017-08-07T12:22:15Z

I use this: [https://github.com/PhilippBaschke/acf-pro-installer](https://github.com/PhilippBaschke/acf-pro-installer)  
Which downloads ACF in my theme dir, then with build script I copy ACF to ‘/lib/acf’ dir in my theme folder and I load ACF from there.  
Works well for me this way.

---

## Post 10 by @Jpwaldstein — 2017-08-09T20:21:21Z

Carbon Fields has both repeater & flexible content fields, they are called ‘complex fields’. CF has just about everything ACF does and is way more efficient to work with.

---

## Post 11 by @shov — 2017-12-12T10:01:39Z

```
...
"repositories":[
 {
 "type":"composer",
 "url":"https://wpackagist.org"
 }
],
"require": {
 "php": ">=7.1",
 "johnpbloch/wordpress": "^4.9",
 "wpackagist-plugin/advanced-custom-fields": "5.6.7"
},
"extra": {
 "installer-paths": {
 "wordpress/wp-content/plugins/{$name}": ["wpackagist-plugin/advanced-custom-fields"]
 }
},
...
```
