acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
239 stars 27 forks source link

Install ACF Extended Pro with Composer #94

Closed mrcsmcln closed 5 months ago

mrcsmcln commented 2 years ago

Is your feature request related to a problem? Please describe. To my knowledge, there is currently no way to install ACF Extended Pro with Composer.

Describe the solution you'd like I'd like to be able to install ACF Extended Pro with Composer. Unfortunately, I think this might involve circumventing Easy Digital Downloads.

Describe alternatives you've considered WordPress Packagist only works for plugins published to the official WordPress plugin directory. private-composer-installer is used to get around this. Just plug in the URL and add a key to .env and you're good to go. Unfortunately, this only works when the download URL is static.

Additional context The ACF Extended Pro download URL has two query parameters that change every time the download page is refreshed. By contrast, the ACF Pro download URL only uses the license token to verify the download. If we were to switch to license-based authorization (as opposed to the current token-based authorization), then this should solve the problem.

ACF Pro uses the following format:

https://connect.advancedcustomfields.com/v2/plugins/download?p=pro&k={{ ACF_LICENSE_KEY }}

By contrast, ACF Extended Pro uses this format:

https://www.acf-extended.com/index.php?eddfile={{ EDD_FILE }}&ttl={{ DYNAMIC_TTL }}&file={{ 
FILE_ID }}&token={{ DYNAMIC_TOKEN }}

From there, Composer installation using private-composer-installer should be straightforward:

{
  "type": "package",
  "package": {
    "name": "acf-extended/acf-extended-pro",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://www.acf-extended.com/index.php&k={%ACF_EXTENDED_LICENSE_KEY}"
    },
    "require": {
      "composer/installers": "^1.4",
      "ffraenz/private-composer-installer": "^5.0"
    }
  }
}
mcaskill commented 1 year ago

Based on my past experience with EDD packages, I suggest using edd_action=get_version until a better solution arises either with ffraenz/private-composer-installer or with ACF Extended:

curl 'https://www.acf-extended.com/?edd_action=get_version&license={%ACF_EXTENDED_LICENSE_KEY}&item_name=ACF+Extended+Pro&url={%ACF_EXTENDED_LICENSE_URL}' | json_pp

This action returns a JSON response that contains a download_link with the URL to download the pro plugin.

I've created a pull request to add the pro version to junaidbhura/composer-wp-pro-plugins.

Support for ACF Extended Pro was introduced in junaidbhura/composer-wp-pro-plugins v1.6.0

acf-extended commented 5 months ago

Hello,

Thanks for the feedback!

You can use the following composer repo to install ACF Extended Pro with your license key: https://github.com/junaidbhura/composer-wp-pro-plugins.

I’ve planned to implement a builtin composer solution in the future with auth key etc… But I don’t have any ETA yet. In the meantime this repo will work just fine.

Hope it helps!

Have a nice day!

Regards.