Skip to content
Kelvin Mo edited this page Apr 9, 2018 · 1 revision

Extensions

Introduction

SimpleID has the ability to support "extensions". Extensions are PHP files containing code which extends the functionality of SimpleID. The code within extensions follow a set of conventions which allows SimpleID to call them during key parts of the OpenID authentication process.

The main purpose of SimpleID extensions is to provide a way in which to implement OpenID 2.0 extensions. However, the system is flexible enough for SimpleID extensions to function in other ways.

How to create extensions

Extensions are named name.extension.php, where name is the name of the extension. Each extension resides in its own directory underneath the extensions subdirectory of the SimpleID web directory (www). Thus an extension named example would reside as /www/example/example.extension.php. To avoid naming conflicts, extensions should not have the same name as any other PHP file in the core SimpleID distribution.

Extensions are essentially implementations of various hooks, which are called by SimpleID at various points. Extensions can also contain other code, as well as HTML templates.

By convention, all functions within an extension should begin with the name of the extension, prefixed with an optional underscore. This is to avoid potential namespace conflicts with other extensions.

The best way to learn is to look through the extensions that are packaged in the SimpleID distribution.