Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

composer.json for an extension

The composer.json that installs an extension into extension/<name>: package type, installer, extension name, PHP and kernel requirements, license, authors, with two real examples.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-3-extension-developer/composer-json-for-extensions.md

On this page

composer.json for an extension

Part 3, chapter 6. With a composer.json, your extension can be installed with composer require and published on Packagist. This chapter explains the fields that matter for an extension, using two real files.

A modern example

se7enxweb/expqueue's composer.json (shortened):

{
    "name": "se7enxweb/expqueue",
    "description": "The Exponential job queue: a generic, database-backed job queue ...",
    "type": "ezpublish-legacy-extension",
    "homepage": "https://github.com/se7enxweb/expqueue",
    "license": "GPL-2.0-or-later",
    "authors": [
        { "name": "7x", "homepage": "https://se7enx.com", "role": "Author" }
    ],
    "support": {
        "issues": "https://github.com/se7enxweb/expqueue/issues",
        "source": "https://github.com/se7enxweb/expqueue"
    },
    "require": {
        "php": ">=8.0",
        "ext-json": "*",
        "ext-mbstring": "*",
        "se7enxweb/exponential": "^6.0.14",
        "se7enxweb/ezpublish-legacy-installer": "*"
    },
    "extra": {
        "ezpublish-legacy-extension-name": "expqueue"
    }
}

The fields

FieldWhat to writeWhy
name<vendor>/<package>, lower casethe Packagist name; usually the repository name
typeezpublish-legacy-extensiontells the installer to put the package in extension/
extra.ezpublish-legacy-extension-namethe folder namethe installer names the folder after it; without it the package name is used
require.phpthe PHP versions you tested>=8.0, or a list such as ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4
require of a legacy installerse7enxweb/ezpublish-legacy-installer or se7enxweb/exponential-legacy-installerthe Composer plugin that knows the extension type (the kernel's composer.json requires both)
require.se7enxweb/exponentialthe kernel versions your code needs, when it uses new kernel APIsComposer refuses an installation with an older kernel
require.ext-*PHP extensions you calla clear error instead of a fatal at run time
licensean SPDX identifier: GPL-2.0-or-laterPackagist and tools read it
authorseveryone who wrote it, including original authorscredit; see below
supportissues and source linkswhere users report problems
suggestoptional packages with a reasonshown by Composer on install

Do not put version into composer.json unless you keep it in step with every tag: Packagist takes versions from tags. If you keep one, bump it with ezinfo.php and extension.xml (Bumping ezinfo.php and extension.xml).

Crediting the original author

se7enxweb/expchangeclass is a fork; its composer.json keeps the original author:

"authors": [
    { "name": "7x", "homepage": "https://se7enx.com" },
    { "name": "<original author>", "role": "Original author of eZChangeclass" }
]

(The real file names the person; this page leaves names of individuals out.) Do the same when you fork: Attribution and copyright notices.

Check it

composer validate extension/mysite_hello/composer.json

composer validate reports missing or invalid fields; fix every error, and read the warnings.

Installing it from a repository before Packagist

While the package is not on Packagist, a project can install it from Git by adding a repository to its own composer.json:

"repositories": [
    { "type": "vcs", "url": "https://github.com/your-organization/mysite_hello" }
]

then composer require your-organization/mysite_hello:dev-main. Publishing on Packagist is Composer and Packagist.

Warning

Never run composer update on a live site to try a new extension. Try it on your development installation, commit composer.lock, and deploy that.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x