From a56340e1c30b7031e868671cf4c6fdc3f81c74bd Mon Sep 17 00:00:00 2001 From: Ben van Hartingsveldt Date: Thu, 8 Aug 2024 00:20:53 +0200 Subject: [PATCH] Add usage information --- README.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2499874..75519bc 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,40 @@ This yocLibrary enables your project to send and receive with EPP (Extensible Pr `composer require yocto/yoclib-epp` -## Use +## Usage -*TODO* \ No newline at end of file +### Serializing + +```php +use YOCLIB\EPP\EPPDocumentHelper; + +$doc = EPPDocumentHelper::createEPPDocument(); + +$epp = $doc->createElementNS('urn:ietf:params:xml:ns:epp-1.0','epp'); + +$hello = $doc->createElementNS('urn:ietf:params:xml:ns:epp-1.0','hello'); + +$epp->appendChild($hello); + +$doc->appendChild($epp); + +$xml = $doc->saveXML(); +``` + +### Deserializing + +```php +use YOCLIB\EPP\EPPDocumentHelper; +use YOCLIB\EPP\Elements\EPPEppElement; + +$xml = ''; + +$doc = EPPDocumentHelper::createEPPDocument(); + +$doc->loadXML($xml); + +/**@var EPPEppElement $epp*/ +$epp = $doc->documentElement; + +$hello = $epp->getHello(); +``` \ No newline at end of file