Composer and Packagist
Part 7, chapter 5. Packagist is the public index Composer looks in. Once your extension is registered there, a site installs it with one command, and gets your updates with another. This chapter registers an extension and shows what users then do.
Before you submit
- The repository is public on GitHub (or another host Packagist can read).
composer.jsonis valid and complete (composer.json for an extension):name,description,typeezpublish-legacy-extension,license,requirewithphpand an installer, andextra.ezpublish-legacy-extension-name.composer validatepasses.- There is at least one tag (Choosing the next version number).
composer validateSubmit
- Sign in on packagist.org (with your GitHub account is easiest).
- Click Submit.
- Paste the repository's address, for example
https://github.com/your-account/myext. - Packagist reads
composer.json, shows the package name, and creates the package pagehttps://packagist.org/packages/your-account/myext.
The package name comes from composer.json, not from the repository name. It must be free on Packagist, and it
belongs to whoever registered it first, which is why a fork uses its own vendor name.
Where versions come from
Packagist creates one version per tag (v1.2.4 becomes 1.2.4) and one development version per branch (main
becomes dev-main). It reads them when it is told the repository changed: through the GitHub integration, which you
should check after the first submit (The Packagist webhook).
A version field in composer.json is not needed and, if present, must match each tag exactly, so most extensions
leave it out.
What users do
composer require your-account/myext:^1.2Composer finds the package, checks that its requirements fit the site (PHP version, other packages), downloads it,
and the legacy installer plugin puts it into extension/myext/ (the name from
extra.ezpublish-legacy-extension-name). Then the user activates it and clears the caches, as your README says.
Later:
composer update your-account/myexttakes the newest version their constraint allows (Versioning rules).
Requirements that protect users
What you put in require decides where your extension can be installed:
| Requirement | Effect |
|---|---|
"php": "^8.0" | Composer refuses to install on PHP 7 |
"se7enxweb/exponential": "^6.0.14" | refuses to install with an older kernel (use it when you call APIs that came with that release) |
"ext-mbstring": "*" | refuses when the PHP extension is missing, instead of a fatal error later |
| another extension with a version range | installs it too, or refuses on a conflict |
Require what you really need, and no more: every requirement is a reason Composer may refuse.
Updating the package information
The package page updates itself when the webhook works. If it does not, the package page has an Update button for maintainers; use it once, then fix the webhook.
Related pages
- Previous: Bumping ezinfo.php and extension.xml
- Next: The Packagist webhook
- Modernizing composer.json
- Packagist: about
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
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.