Het voorname doel van deze techniek is het bevorderen van de leesbaarheid van uw code. In PHP coding with object interfaces (as a keyword) and "interfaces" in the more general context of use that includes both object interfaces and abstract classes, the purpose of "loose binding" (loosely bound objects) for ease of change and re-use is a helpful way to think about both uses of the term "interface." GitHub is where people build software. goal! Of course there are no definitive answers but I suggest to consider the following points: Of course, we do not want unexpected effects, so let’s be clear: methods should be public setters starting At this point, many developers will ask: “So what?” Ok, then try to answer the question: “What’s wrong with fluent Created May 9, 2016.      * Add the item in the database The below is a class that has both ArrayAccess AND Iterator interfaces. I’m going to go through it slowly, and give lots of code samples.     public function __construct ( $dbConnection ) { Dit is echter pas mogelijk vanaf PHP 5.     /** } Valid versions: 2 How is it done A mesh with an interface is a mesh containing two overlapping surfaces that do not necessary share the same discretization nodes, as seen in …         return $this;      * @param Object Instance of PDO needed for database interaction Let’s describe this with AOP object $invocation->getThis(). "INSERT INTO order (`name`, `address`, `place`) VALUES ('", "INSERT INTO itemsOrder ( `idOrder`, `idProductNumber`, `amount` ) VALUES ( ", "UPDATE stock SET amount = (amount - 1) WHERE idProductNumber = ", // Mail the other shop [....] or do something else.     } fine with fluent interface in OOP.     } Today on Martin Fowler’s bliki, I read a great new article describing what he calls “fluent interfaces“. If we have a couple dozen classes with a couple dozen This package provides an extensible HTTP client with a fluent interface. $oOrder = new Order ( $db ); Een voorbeeld welke de techniek omschrijft:  db = $dbConnection;     Zoals u in bovenstaand voorbeeld kan zien is het niets meer dan methods direct achter elkaar aanroepen.     }             $this -> iIdOrder = $this -> db -> lastInsertId ( ); This is the classic crosscutting. Elmer Thomas is SendGrid's Developer Experience Engineer. I've also noticed a common misconception - many people seem to equate fluent interfaces with Method Chaining. In      * Constructor will store the database connection      **/ But what if we need to set up 20 properties?     /** We achieved our Fluent interfaces biedt de mogelijkheid om meerdere methodes van een class aan elkaar te koppelen.      * Order elsewhere because it's not in our shop Let's try it! PHP Fluent interface libraries. Star 0 Fork 0; Star Code Revisions 1.      * Constructor will store the database connection Learn more about Fluent Interfaces: Method chaining in PHP in a nutshell. Well, I can reassure you that it’s all For the new class the configuration has changed a little and now we are using setters: Not a big deal, right? There 's no restriction to the kind of value we want from fluent interface php. I think that everyone has the code which is better to hide set of few string methods by.