The Gravity PDF plugin started its life as a developer tool. While it’s had a dramatic transformation over the years, we’ve never lost site of that original goal: to make it easier for developers to generate PDFs with Gravity Forms.
To that end, it’s only fitting we have come full circle. I’m very pleased to announce the Canonical Gravity PDF plugin, and all paid Extensions, can now be installed from the CLI with Composer.
Importantly, this doesn’t replace the standard installation and upgrade process for everyday users. If you are reading this and have no idea what Composer is, you can safely ignore this post. We’ve only added an alternate way for developers to manage Gravity PDF plugins on their sites.
Install the Canonical Gravity PDF Plugin
Follow these simple steps to install the canonical Gravity PDF plugin using Composer:
- Open your
composer.json
file and add the Gravity PDF repository:
"repositories": [
{
"type": "composer",
"url": "https://composer.gravitypdf.com",
"only": [
"gravitypdf/*"
]
}
]
- From your CLI add the Gravity PDF plugin to your project with the command:
composer require gravitypdf/gravity-pdf
- If the CLI prompts you about the
composer/installers
package choose yes (y
). The package ensures Gravity PDF is automatically installed to/wp-content/plugins/
, and not the/vendor/
directory.
Refer to our documentation for a basic example of what your composer.json
file might look like after completing all the steps.
If you're using Trellis / Bedrock, Gravity PDF will respect the custom installation path you define for wordpress-plugin
packages.
Install Gravity PDF Extensions
All Gravity PDF Extension can be installed with Composer and an active license key.
Before you can install an Extension you’ll need to configure Basic HTTP authentication with your Site URL and License Key:
- Create an
auth.json
file in the same directory as yourcomposer.json
file. - Open
auth.json
and copy/paste the following:
{
"http-basic": {
"composer.gravitypdf.com": {
"username": "https://{WORDPRESS_HOME_URL}",
"password": "{LICENSE_KEY}"
}
}
}
- Replace
{WORDPRESS_HOME_URL}
with your site’s domain name (e.g.example.com
) and{LICENSE_KEY}
with your 32-character key. - Save and close
auth.json
Provided you’ve already configured our repository and installed the canonical Gravity PDF plugin (see above), you can now add our Extensions to your project:
composer require gravitypdf/gravity-pdf-previewer
For a list of available extensions to install run composer suggest
in your CLI. Just be aware the suggested list shows all extensions, regardless of if your license key gives you access to it.
What About Installing Premium Templates With Composer?
Unfortunately this feature isn’t available just yet. Premium templates have unique properties that we need to handle a bit differently than Extensions. But rest assured this is an important feature we are planning to tackle next year.
Help and Support
Please reach out to our friendly support team if you need assistance installing Gravity PDF with Composer.
Happy PDFing!