PHP code example of i4erkasov / phalcon-xml-annotations

1. Go to this page and download the library: Download i4erkasov/phalcon-xml-annotations library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

i4erkasov / phalcon-xml-annotations example snippets




use ExamplePhalconXML\IrishPub;
use I4\Phalcon\XML\Analyzer;
use I4\Phalcon\XML\XmlAnnotations;
use Phalcon\Annotations\Adapter\Memory;

$annotations = new XmlAnnotations(
    new Analyzer(new Memory())
);

$xml = $annotations->parse(
    new IrishPub(
        'The Shamrock Pub',
        'Dublin, Ireland',
        '10:00 AM',
        '2:00 AM'
    )
);

$xml->setExtraAttributes([
    'Beer' => [
        'Date' => (new DateTime('now'))->format('Y-m-d'),
    ]
]);

echo $xml->getString(); // Returns the XML as a string

echo $xml->save('/tmp/file.xml'); // Saves the generated XML to a file