Download Astra Pro With Composer

Download Astra Pro With Composer

Composer is a dependency manager for PHP, which you can use for your WordPress websites. This document will show you how to manage Astra Pro on your projects using Composer.

With Composer, you can add all of your standard themes and plugins to a new WordPress site from one place. Also, you can keep your websites updated the same way.

Configure The Composer.json File

To update or install the Astra Pro plugin with Composer, you first need to configure the composer.json file. 

Here, we assume that you already have the file in your website’s root directory. Also, we are assuming that you have set your project. Check this article if you need help installing Composer, adding composer.json file, or setting up the project.

Let’s get started.

Note:

If you’re installing an Astra Pro for the first time on your website, the plugin will not be activated in this process. Once you import the plugin to your website, you will need to log in to your Dashboard and activate your Astra Pro license.

Code Example

You can check the example of the entire code:

{
“name”: “example/example”,
“type”: “project”,
“description”: “Project description”,
“require”: {
“brainstormforce/astra-addon”: “^3.0”
},
“extra”: {
“installer-paths”: {
“wp-content/plugins/{$name}/”: [“type:wordpress-plugin”]
}
},
“repositories”: [
{
“type”: “package”,
“package”: {
“name”: “brainstormforce/astra-addon”,
“version”: “3.6.3”,
“type”: “wordpress-plugin”,
“dist”: {
“type”: “zip”,
“url”: “https://support.brainstormforce.com/wp-json/bsf-products/v1/download/astra-addon/?purchase_key={PURCHASE_KEY}&site_url={SITE_URL}”
},
“require”: {
“composer/installers”: “^1.11”
}
}
}
]
}

Further below, we’ll show you how to make this work.

Add Astra Pro Package And Version Constraints

“require”: {
“brainstormforce/astra-addon”: “^3.0”
},

You need to add the following line to your composer.json file under the “require” key. This will tell Composer to add the Astra Pro package to the list of packages your project depends on. 

Also, this will set the Astra Pro plugin version constraints to any stable version above 3.0.0.

Repositories Arrey

“repositories”: [
{
“type”: “package”,
“package”: {

}
}
}
]

Next, you need to register Astra Pro Package Repository in your composer.json file. To do this, you must first edit the Astra Pro Package object. 

repositories: Repository Arrey containing Astra Pro Package object

ElementDescriptionTypepackagePackage description for Astra Pro version which is requestedpackage element

Astra Pro Package Object

The “package” object contains data on the Astra Pro package you are requesting. Here, you need to modify the version string for each update.

“package”: {
“name”: “brainstormforce/astra-addon”,
“version”: “3.6.3”,
“type”: “wordpress-plugin”,
“dist”: {
“type”: “zip”,
“url”: “https://support.brainstormforce.com/wp-json/bsf-products/v1/download/astra-addon/?purchase_key={PURCHASE_KEY}&site_url={SITE_URL}”
},
“require”: {
“composer/installers”: “^1.11”
}
}

package: Astra Pro Package Description Object

ElementDescriptionTypeNotesversionThe Astra Pro version which is requestedstringYou need to specify the exact version in format “X.X.X” (e.g. “3.6.3”) for each update.distThe packaged version of Astra Pro stable version filesPackage data objecturlDownload link with authentication parametersstringurl element

Also, you need to update the url parameters by adding your Astra Pro license key and a domain of the website on which you’re updating the plugin.

url: URL parameters

ParameterDescriptionTypeRequiredNotesPURCHASE_KEYThe Astra Pro keystringRequiredThe key can be acquired from our Store at Account > LicensesSITE_URLThe domain of your website (without HTTPS)stringRequiredValid format is: “example.com” (not “https://example.com”)

URL example:

https://support.brainstormforce.com/wp-json/bsf-products/v1/download/astra-addon/?purchase_key=fdsi3h3iu4n22l344n4l2&site_url=example.com

Install or Update Astra Pro With Composer

Now that your composer.json is configured, you are ready to update or install Astra Pro on your website. You can install or update Astra Pro by running the following command in Composer:

composer update

上次修改 2022.1.1