No results found. Try again with different words?

Search must be at least 3 characters.

Manage 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.

Using Astra Pro With Composer

You can use Composer to upgrade or downgrade Astra Pro. Before using Composer, you’ll need to have the Astra Pro plugin installed and your license activated. Thus, you’ll need to do this manually on any new website.

Follow these steps to prepare your new website before using Composer:

Step 1 – Install and activate the Astra Pro plugin. If you’re not sure how to do this, you can check out this document;

Step 2 – Next, copy your Astra Pro license from the Store, and activate the license on your website. Further, you can find more details about activating the license in this document.

Activating the plugin license on your new website will register the website URL with our Store. Now you can configure your Composer.json file and manage Astra Pro with Composer further on.

Configure The Composer.json File

The composer.json file is necessary for Composer to work on your website. To manage the Astra Pro with Composer, you’ll need to configure the composer.json file and add Astra Pro-related code. 

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.

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

ElementDescriptionType
packagePackage 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. Thus, to upgrade Astra Pro with Composer, add a version number higher than the one you have currently installed. Similarly, to downgrade Astra Pro, add an earlier plugin version number.

"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

ElementDescriptionTypeNotes
versionThe 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 object

url
Download 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

ParameterDescriptionTypeRequiredNotes
PURCHASE_KEYThe Astra Pro keystringRequiredThe key can be acquired from our Store at Account > Licenses
SITE_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
Was this article helpful?
Did not find a solution? We are here to help you succeed.

Related Docs

Astra is Free. Now & Forever.

We believe creating beautiful websites should not be expensive. That's why Astra is free for everyone. Get started for free and extend with affordable packages.

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form