-
Notifications
You must be signed in to change notification settings - Fork 20
Loader Plugins
Thomas Weinert edited this page Feb 1, 2015
·
3 revisions
You can define you own loaders in separate Composer packages. Here are several reasons for this approach.
- Special formats that are not needed often.
- Dependencies to 3rd party libraries
- Separate updates and releases
The composer.json
of the plugin should require the FluentDOM package and add a file based autoloader.
{
"require": {
"fluentdom/fluentdom": "~5.2",
},
"autoload": {
"files" : ["src/plugin.php"]
}
}
The file based autoloader triggers the plugin registration.
namespace FluentDOM\HTML5 {
if (class_exists('\\FluentDOM')) {
\FluentDOM::registerLoader(
new \FluentDOM\Loader\Lazy(
[
'text/html5' => function () {
return new Loader;
},
'html5' => function () {
return new Loader;
}
]
)
);
}
}
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces