Flarum Composer Commands and Usage

6,633 0

Flarum’s official recommended installation method is to use Composer. You can search Google or Baidu for tutorials on installing Composer. LNMP and LAMP come with it, so they will not be discussed here. If you find that Composer updates are slow, fail, or even produce errors when setting up on a local machine or a server in China, you can use a domestic mirror.

Bash
sudo composer config -g repo.packagist composer https://packagist.phpcomposer.com

After entering the command, simply running composer update will use the domestic mirror.

Common Composer Commands

Using the plugin flagrow/ads as an example:

Install a plugin

Bash
composer require flagrow/ads

Remove a plugin

Bash
composer remove flagrow/ads

Update a plugin

Bash
composer update flagrow/ads

Running composer update in the Flarum root directory updates the entire Flarum installation, including plugins.

Specify a Version When Installing a Plugin

Using the plugin flagrow/upload as an example:

Bash
composer require flagrow/upload:0.4.13

You can also use the following command to update to a minor version within a major version:

Bash
composer require flagrow/upload:0.4.*

If you need to install the latest development version:

Bash
composer require flagrow/upload:dev-master

If you want to install the official Flarum development version (dev), here is one recommended method:

After installing the beta version, modify the composer.json file in the root directory.

Change the flarum/core version to "flarum/core": "0.1.x-dev".

Then replace all the flarum/flarum-ext-**** versions with dev-master.

In other words, batch-replace ^0.1.0 with dev-master.

Finally, run composer update to update to the dev version.

Comments

(0)

No comments yet. Start the conversation.

Leave a comment

© 2026 Carefree. All rights reserved.

Carefree is a personal site about technology and everyday life, documenting web development, backend, and DevOps practices, plus software tools, digital experiences, and thoughts beyond code.