require and suggest: what a theme depends on
This page is for designers deciding what their theme's composer.json should pull in.
The rule of thumb
Put it in require when | Put it in suggest when |
|---|---|
| The theme fails without it (a fatal error, a blank page) | The theme works, but a feature is missing without it |
| It is the installer plugin that places the theme | It is content or data the user may already have |
| It is the PHP version range you test | It is an alternative the user may prefer |
Real choices
sevenx_themes_mediarequires only PHP (^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4) and suggestsse7enxweb/explayouts(renders the layout structure its templates are written for),se7enxweb/expsite-data-media(the content model and data it renders) andse7enxweb/expsite-api.ezwebinrequiresse7enxweb/ezpublish-legacy-installerandse7enxweb/expui, and suggests three smaller extensions with a~5.3constraint.
Both are reasonable: the media theme leaves the choice of data to the site; ezwebin cannot draw without expui.
Version constraints
| Constraint | Allows | Use for |
|---|---|---|
^1.2 | >=1.2.0 <2.0.0 | Libraries that follow semantic versioning |
~1.2.3 | >=1.2.3 <1.3.0 | Packages that only add fixes in the last position |
~0.0.4.9 | >=0.0.4.9 <0.0.5.0 (so 0.0.4.10 is included) | Four-position versions where only the last moves |
* | anything | Only for the installer plugin, if at all |
The tilde floats the last position given, so a series that counts .9, .10, .11 stays inside it
(After .9 comes .10).
Step by step
- List what your templates and operators call that is not in the kernel.
- Sort each into
requireorsuggestwith the table above. Asuggestentry's text says what it adds. - Write the narrowest PHP range you actually test.
- Run
composer validateand install the theme into a clean test installation to see thatrequireis enough. - In
extension.xml, declare the extensions you override or rely on for the loading order (Declaring dependencies).
Related pages
- composer.json for a theme
- Version constraints your users write
- PHP version compatibility
- 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.