Composer

Last modified:

Blockstudio can be added to projects using composer with the private-composer-installer package. It allows you to install packages from private URLs within composer.json.

Setup

.env

It is good practice to store all your credentials and private keys in an .env file. If you haven't done so already, create a .env file in the root of your project and add your Blockstudio license key

.env

                BLOCKSTUDIO_KEY=your-blockstudio-license-key

      
Copy

composer.json

Below is an example composer.json file that uses the private-composer-installer.

composer.json

            {
      "name": "my-company/my-project",
      "description": "WordPress plugin.",
      "license": "proprietary",
      "repositories": [
        {
          "type": "package",
          "package": {
            "name": "fabrikat/blockstudio",
            "version": "4.0.2",
            "type": "vendor",
            "dist": {
              "type": "zip",
              "url": "https://blockstudio.dev/download?v={%VERSION}&k={%BLOCKSTUDIO_KEY}"
            },
            "require": {
              "ffraenz/private-composer-installer": "^5.0.1"
            }
          }
        }
      ],
      "config": {
        "allow-plugins": {
          "composer/installers": true,
          "ffraenz/private-composer-installer": true
        }
      },
      "require": {
        "fabrikat/blockstudio": "^4.0.2",
      }
    }

      
Copy