v1.0.0 2023-06-01 22:34 UTC

This package is auto-updated.

Last update: 2024-04-04 02:18:51 UTC


Latest Stable Version Total Downloads Packagist PHP Version License

Phalcon XML Annotations is a library that allows you to convert PHP objects into XML files. It provides annotations to define the structure and parameters of XML files based on PHP objects.


You can install the Phalcon XML Annotations library using Composer. Simply run the following command in your project:

composer require i4erkasov/phalcon-xml-annotations


⚠️ Documentation is under development: This library is actively being developed, and documentation is currently being created. We apologize for any inconvenience. Please refer to the source code and examples for usage instructions and implementation details. Thank you for your understanding.

Usage Example

See the example directory for context.



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'

    '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


<?xml version="1.0" encoding="UTF-8"?>
  <IrishPub Name="The Shamrock Pub" Address="Dublin, Irelan" OpeningTime="10:00 AM" ClosingTime="2:00 AM">
      <![CDATA[Irish Pub]]>
      <Beer Date="2023-06-02" Brand="Guinness" Type="Stout" ABV="4.2" Country="Ireland"/>
      <Beer Date="2023-06-02" Brand="Smithwick's" Type="Red Ale" ABV="4.5" Country="Ireland"/>
      <Beer Date="2023-06-02" Brand="Harp Lager" Type="Lager" ABV="4.5" Country="Ireland"/>


You can contribute to the development of this library by creating issues, suggesting new features, and submitting pull requests to the GitHub repository.


Phalcon XML Annotations is released under the MIT License.