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

By hand: the smallest extension in five minutes

Three files make a complete extension - ezinfo.php, extension.xml and one settings file. Create them, check them, switch the extension on, see it in Setup > Extensions and see its setting win, then put it under Git.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-3-extension-developer/tutorials/by-hand-minimal-extension.md

On this page

By hand: the smallest extension in five minutes

Tutorial 9. This is the smallest useful extension: it has metadata, so the administration knows what it is, and one setting, so it changes something you can see. Every later tutorial adds to the same folder, extension/mysite_hello. The files below passed php -l and xmllint.

1. The folder

mkdir -p extension/mysite_hello/settings
cd extension/mysite_hello
git init

2. ezinfo.php

<?php
class mysite_helloInfo
{
    public static function info()
    {
        return array(
            'Name'      => "My Site Hello",
            'Version'   => "0.1.0",
            'Copyright' => "Copyright (C) 2026 Your Organization",
            'License'   => "GNU General Public License v2.0 (or any later version)",
            'Info_url'  => "https://github.com/your-organization/mysite_hello"
        );
    }
}

The class is the folder name plus Info; the keys are quoted; info() is static (ezinfo.php).

3. extension.xml

<?xml version="1.0" encoding="utf-8" ?>
<software>
    <metadata>
        <name>My Site Hello</name>
        <version>0.1.0</version>
        <copyright>Copyright (C) 2026 Your Organization</copyright>
        <license>GNU General Public License v2.0 (or any later version)</license>
        <info_url>https://github.com/your-organization/mysite_hello</info_url>
    </metadata>
</software>

4. One setting

settings/site.ini.append.php:

<?php /* #?ini charset="utf-8"?

[SiteSettings]
SiteName=Hello from mysite_hello

*/ ?>

5. Check

php -l ezinfo.php
php -l settings/site.ini.append.php
xmllint --noout extension.xml
cd ../..

Expected: two No syntax errors detected lines and nothing from xmllint.

6. Switch it on

./console exp:ini add 'site.ini/ExtensionSettings/ActiveExtensions[]' mysite_hello global
php bin/php/ezcache.php --clear-tag=ini

7. See it

  • Setup > Extensions: a card "My Site Hello", version 0.1.0, your license and website.

  • The setting:

    ./console exp:ini where site.ini/SiteSettings/SiteName

    lists your file. Whether it wins depends on the order: a later file (the global override, or an extension listed before yours) may set SiteName too; the last line of the output says which value is in effect. See Settings scopes and the order they win in.

8. Commit

git -C extension/mysite_hello add ezinfo.php extension.xml settings/site.ini.append.php
git -C extension/mysite_hello commit -m "Added: The mysite_hello extension with its metadata and a site name"

Undo

./console exp:ini rem 'site.ini/ExtensionSettings/ActiveExtensions[]' mysite_hello global
php bin/php/ezcache.php --clear-tag=ini

The next tutorials keep the extension active and add a template operator, a fetch function, a module and more. The SiteName line was only for this exercise: remove it before you continue.

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