Fluent Interface¶
A fluent interface, or fluid interface, is an object-oriented API whose design relies extensively on method chaining.
A fluent interface is not related to an interface : it may be implemented without them.
<?php
class script {
function hello() {
print 'Hello ';
return $this;
}
function word() {
print 'word.';
return $this;
}
}
$script = new Script();
$script->hello()->world();
//
?>
See also Fluent Interface, Fluent Interfaces Are Bad for Maintainability, Fluent Interfaces are Evil
Related : Final Keyword, Interface