-
Notifications
You must be signed in to change notification settings - Fork 20
Plugin Guidelines
Plugins should be implemented as Composer packages into thei own repositories. Please add the fluentdom/fluentdom
as an dependency limited to the major version. The plugin APIs might (only) change between major version.
"require": {
"fluentdom/fluentdom": "6.x",
//...
},
Are used to load some content into a DOM document. They need to implement FluentDOM\Loadable
and can be registered with FluentDOM::registerLoader()
.
Are functions or instances of FluentDOM\Serializer\Factory
. Serializers need to implement __toString()
.
The plugin convert an selector for the FluentDOM\Query
object into Xpath expressions. At the moment here
are two implementations that convert CSS selectors into Xpath expressions.
Plugins can be registered on the FluentDOM class. To register them automatically add an file autoloader to your composer.json.
"autoload": {
"files" : ["src/plugin.php"],
"psr-4": {
//...
}
}
Then use the static functions to register your plugins.
namespace FluentDOM\YourPlugin {
\FluentDOM::registerLoader(
new Loader(),
'sometype',
'someothertype'
);
\FluentDOM::registerSerializerFactory(
function($contentType, \DOMNode $node) {
return new Serializer($node);
},
'sometype',
'someothertype'
);
}
- 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