Lesson 7.2: extension.xml, ezinfo.php and a license
An extension tells the system who it is in two small files, ezinfo.php and extension.xml. The About page, the
Extensions page and the upgrade checks read them, and anyone who finds the extension on a server learns from them
which release it is and under which license it may be used. In this lesson learners give mysite_hello its
identity and a license.
At a glance
| Course | Developers |
| Module | Module 7: Extensions |
| Duration | 45 minutes (15 presenting, 30 exercise) |
| Level | Intermediate |
| Audience | Developers |
| Prerequisites | Lesson 7.1 |
Learning objectives
After this lesson, learners can:
- write
ezinfo.phpwith a staticinfo()returningName,Version,Copyright,LicenseandInfo_url; - write
extension.xmlwith a<metadata>block that agrees withezinfo.php; - add a
LICENSEfile whose name matches the license line; - check both files with
php -landxmllint --nooutand on the About page (/ezinfo/about); - explain why version fields are raised before a release tag, never after.
Trainer's notes
How to present it
Sources: ezinfo.php: what the About page reads, extension.xml: the packaged description and Specification: extension metadata.
ezinfo.php(4 minutes). The class is the folder name followed byInfo,info()isstatic, every key is a quoted string. Showextension/cjw_themes_jumper/ezinfo.phpif installed.extension.xml(3 minutes).<software><metadata>with<name>,<version>,<copyright>,<license>,<info_url>. The About page readsextension.xmlfirst when it has<metadata>, so both files must agree.- Values never to write (2 minutes).
//autogentag//ordev-masteras a version; a license that differs from theLICENSEfile; a website that is not yours. - The license (3 minutes). Code that builds on the kernel is usually under the GNU GPL, version 2 or later; the license line reads "GNU General Public License v2.0 (or any later version)". Choosing a license is the author's decision; Licensing choices explains the options.
- Versions and tags (3 minutes). A release raises the version in both files in the commit the tag points at. A pushed tag is permanent; a mistake is fixed by the next version, never by moving a tag.
Common questions
Does a private extension need a license? A license file says how others may use the code; for an extension that never leaves your company, the copyright line is still worth keeping correct.
What else carries a version? A version in composer.json if you keep one, and a version header in a
share/filelist.md5 if the extension has one; they move together.
Which version number for a first release? Your choice; the designers' distribution pages explain the
convention that only the last position counts on (1.0.9 is followed by 1.0.10).
Pitfalls
- A non-static
info()or unquoted keys. The About page shows dashes. - Different values in the two files. The About page shows the
extension.xmlvalues, which may be the stale ones. - Copying a license line from another extension. It must match your own
LICENSEfile.
Hands-on exercise
On the development installation, in extension/mysite_hello.
Create
ezinfo.php:class mysite_helloInfo { public static function info() { return array( 'Name' => "Mysite Hello", 'Version' => "0.1.0", 'Copyright' => "Copyright (C) 2026 <your name>", 'License' => "GNU General Public License v2.0 (or any later version)", 'Info_url' => "https://example.invalid/mysite_hello", ); } }Create
extension.xmlwith the same values:<software> <metadata> <name>Mysite Hello</name> <version>0.1.0</version> <copyright>Copyright (C) 2026 your name</copyright> <license>GNU General Public License v2.0 (or any later version)</license> <info_url>https://example.invalid/mysite_hello</info_url> </metadata> </software>Add a
LICENSEfile with the full text of the GNU GPL version 2, for example a copy ofextension/ezformtoken/LICENSE, which ships in the kernel repository.Check:
php -l extension/mysite_hello/ezinfo.phpandxmllint --noout extension/mysite_hello/extension.xml.Open the About page,
/ezinfo/aboutin the administration (heading "Exponential information"), and find the row ofmysite_hellounder Extensions.Change the version in
extension.xmlonly to0.1.1, reload the About page, and see which value wins. Put both files back to the same version.Commit the three files with the message
Added: Extension metadata and license.
Expected result
- Step 4:
No syntax errors detectedand no output fromxmllint. - Step 5: a row with the name, version, license and website.
- Step 6: the About page shows
0.1.1, theextension.xmlvalue. - The trainer checks one learner's About page row.
Quiz
- What is the class name in
ezinfo.phpof the extensionmysite_hello? - Which file does the About page read first when both have values?
A.
ezinfo.phpB.extension.xmlC.composer.jsonD.LICENSE - Name two values that must never be written as a version.
- When is the version raised for a release: before or after the tag?
- Which command checks that
extension.xmlis well formed?
Answers
mysite_helloInfo.- B.
extension.xml, when it has a<metadata>block. //autogentag//anddev-master.- Before: in the commit the tag points at. A pushed tag is permanent.
xmllint --noout extension/mysite_hello/extension.xml.
Further reading
- ezinfo.php and extension.xml.
- Keeping every version field in sync.
- The LICENSE file and Licensing choices.
- A pushed tag is permanent.
Related pages
- Module 7: Extensions
- Developers: course overview
- Trainers: start here
- 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.