How to Install a Magento 2 Extension With Composer: Step-by-Step Guide
A practical walkthrough for installing a Magento 2 extension with Composer: private repositories, auth.json, setup:upgrade, production mode steps, updates, uninstalling and…

In this article
To install a Magento 2 extension with Composer, you add the vendor's repository (plus credentials if it's private), run composer require, enable the module, run bin/magento setup:upgrade, compile and deploy static content if the store is in production mode, and flush the cache. It's a handful of commands, but the order and the deploy mode matter.
This guide walks through the full sequence using the free Conviro for Magento extension as the worked example, then covers updating, uninstalling and the errors you're most likely to hit.
Key takeaways
- Run every command from the Magento root as the file system owner, after a backup, and on staging first.
- Developer mode needs setup:upgrade and a cache flush; production mode also needs compilation and static content deployment.
- Uninstall in reverse order: clean up the integration first, then disable, remove and upgrade.
Before you start: prerequisites
Check these before touching production:
- SSH access and Composer on the server. A Composer-based install can't be done from the admin panel.
- A fresh backup of code and database, and ideally a staging copy to test on.
- The right user. Run commands as the file system owner, not root, or you'll create permission problems.
- Your deploy mode. Check it with
bin/magento deploy:mode:show. - A maintenance window for production:
bin/magento maintenance:enablebefore,bin/magento maintenance:disableafter.
For the Conviro extension specifically, you also need Magento Open Source 2.4.4 or later with PHP 7.4 or 8.1–8.4, an HTTPS store URL, Magento cron running, and outbound HTTPS to api.conviro.io. The extension (version 1.4.1 at the time of writing) is install-tested on:
| Magento | PHP | Theme |
|---|---|---|
| 2.4.4-p13 | 8.1 | Luma |
| 2.4.7-p4 | 8.3 | Luma |
| 2.4.9 | 8.4 | Luma and Hyvä 1.5.2 |
Adobe Commerce runs on the same framework but hasn't been tested yet, Hyvä Checkout is untested, and stores on 2.4.0–2.4.3 stay on extension 1.3.5.
How to install a Magento 2 extension with Composer, step by step
Step 1: Add the Composer repository and credentials
Private extensions are served from the vendor's own Composer repository. From the Magento root:
composer config repositories.conviro composer https://repo.conviro.io
composer config http-basic.repo.conviro.io api <CONVIRO_API_KEY>
The first command adds the repository to composer.json. The second stores credentials in auth.json next to it. For Conviro, the username is api and the password is an API key from Developers → API Keys in the Conviro dashboard. More on Conviro's API is on the developers page.
Keep auth.json out of version control. Your repo.magento.com keys usually live in the same file.
Step 2: Run composer require and setup:upgrade
composer require conviro/module-aichat
bin/magento module:enable Conviro_AiChat
bin/magento setup:upgrade
These three commands are the core of any Magento 2 module install:
composer requiredownloads the package intovendor/and records it incomposer.jsonandcomposer.lock. Commit both files so every environment installs the same version.module:enableregisters the module inapp/etc/config.php.setup:upgradeapplies the module's database schema and data patches and updates the module registry.
Step 3: Compile, deploy and flush
In production mode, generated code and static files aren't built on demand, so run:
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
In developer mode, skip both. In either mode, finish with:
bin/magento cache:flush
Then verify the module is active and leave maintenance mode:
bin/magento module:status Conviro_AiChat
bin/magento maintenance:disable
Step 4: Connect the extension in the admin
Most extensions need configuration after install. For Conviro, open Stores › Settings › Conviro Setup. A 7-step wizard runs an environment check, then you click Connect to Conviro, approve the store in the Conviro dashboard, and return to Magento. No API key or token is copied into Magento.
The wizard creates a least-privilege Magento integration (OAuth 1.0a), lets you choose store views, what to sync and which AI actions are allowed, and verifies everything with a test event. Afterwards, the Integration Health card under Stores › Configuration › Conviro › AI Chat checks connection, authentication, webhooks, catalog, orders, cron, version and environment, with fix instructions. The install page and the installation docs cover each step. Connecting needs a Conviro plan with API access, Pro or higher (see pricing).
Updating and uninstalling a Magento 2 module
Updating
composer update conviro/module-aichat
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush
As before, compile and deploy only in production mode. The Magento admin shows a notice with the exact command when a new version ships, and your configuration, API key and integration are preserved.
Uninstalling
Order matters: the disconnect happens in the setup wizard, which is gone once the module is removed.
- Disconnect in the Conviro setup wizard.
- Disable the module:
bin/magento module:disable Conviro_AiChat - Remove the package:
composer remove conviro/module-aichat - Run
bin/magento setup:upgrade.
In production mode, recompile, redeploy static content and flush the cache as usual. Conviro deletes the store's data 30 days after disconnect, or immediately if you choose. The uninstall docs list every step.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| "Allowed memory size exhausted" during Composer | PHP memory limit | Run COMPOSER_MEMORY_LIMIT=-1 composer require ... |
| Compilation runs out of memory | CLI memory limit | Run php -d memory_limit=2G bin/magento setup:di:compile |
| 401 or credential prompt from the repository | Wrong key or username | Re-run the http-basic command; the username is api |
"Permission denied" in generated/, var/ or pub/static/ |
Commands run as root or the wrong user | Fix ownership, then rerun as the file system owner |
| "Please upgrade your database" | setup:upgrade not run | Run bin/magento setup:upgrade |
| Data stops syncing, health card flags cron | Cron not running | Run bin/magento cron:install and check crontab -l |
Cron matters more than it seems. Conviro writes checkout, registration and product-save events to a local queue that Magento cron delivers in the background. The extension is also designed so storefront pages don't call Conviro from PHP and orders still process if Conviro is unreachable. Test the whole flow on staging first; our AI chatbot testing checklist helps after installation.
Frequently Asked Questions
Do I need to run setup:di:compile in developer mode?
No. Developer mode generates code on demand, so setup:upgrade and cache:flush are enough after installing a module. In production mode, run setup:di:compile and setup:static-content:deploy too, or the storefront and admin can break because generated code and static files are missing.
Where does Composer store credentials for a private repository?
composer config http-basic.<host> <user> <password> writes them to auth.json in your project root, next to composer.json. Add --global to store them in your user's Composer home instead. Either way, keep auth.json out of version control so keys don't leak.
How do I check if a Magento 2 module is enabled?
Run bin/magento module:status to list enabled and disabled modules, or add the module name, for example bin/magento module:status Conviro_AiChat. If it's listed as disabled, run module:enable, then setup:upgrade and a cache flush.
Can I install a Magento extension without SSH access?
Not with Composer. The Conviro extension needs SSH or CLI access and Composer on the server. If your host doesn't provide them, ask your hosting provider or agency to run the install. On the Enterprise plan, Conviro's team installs the extension at no extra cost.
Next steps
Run the install on staging, walk through the setup wizard, and check the Integration Health card before repeating it in production. For a full tour of what the extension does once connected, read our Magento 2 AI chat extension overview. Ready to connect? Create your Conviro account.
Published by
Conviro
Sharing insights on AI-powered customer support, chatbot automation, and SaaS growth strategies.
Build on Conviro
Connect conversational workflows to your stack
Review developer resources and integration patterns before you design the implementation.


