mediasoep / acf-pro-installer
An install helper for Advanced Custom Fields PRO
Requires
- php: >=7.1
- composer-plugin-api: ^1.0
- vlucas/phpdotenv: ^5.1
Requires (Dev)
- composer/composer: 1.0.*
- phpunit/phpunit: 4.8.*
- satooshi/php-coveralls: 1.*
- squizlabs/php_codesniffer: 2.*
README
A composer plugin that makes installing ACF PRO with composer easier.
Fork from ACF Pro Installer.
Differences between this repo and parent:
- support for new ACF version format (ex beta versions)
- ACF Pro key can be stored in a
.acf
file - Updated vlucas/phpdotenv from version ^2.2 to ^3.3
Usage
It reads your :key: ACF PRO key from the environment or a .env file.
1. Add the package repository to the repositories
field in composer.json
(based on this gist):
{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "*.*.*(.*)",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://connect.advancedcustomfields.com/index.php?p=pro&a=download"
},
"require": {
"MediaSoep/acf-pro-installer": "^1.0",
"composer/installers": "^1.0"
}
}
}
Replace "version": "*.*.*(.*)"
with your desired version.
Replace "type": "wordpress-plugin"
with "type": "library"
if you would like to have ACF PRO installed in the ./vendor
directory instead of ./wp-content/plugins
. This may be desireable if for example, you are including ACF PRO in a WordPress theme.
2. Make your ACF PRO key available
Set the environment variable ACF_PRO_KEY
to your ACF PRO key.
Alternatively you can add an entry to your .env
file:
# .env (same directory as composer.json)
ACF_PRO_KEY=Your-Key-Here
or add the key to an .acf
file:
# .acf (same directory as composer.json)
Your-Key-Here
3. Require ACF PRO
composer require advanced-custom-fields/advanced-custom-fields-pro:*
You can specify an exact version (that matches your desired version).
If you use *``**, composer will install the version from the package repository (see 1). This has the benefit that you only need to change the version in the package repository when you want to update.
Be aware that composer update
will only work if you change the version
in the package repository. Decreasing the version only works if you require an exact version.