PHP code example of devgeniem / wp-exhale

1. Go to this page and download the library: Download devgeniem/wp-exhale 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/ */

    

devgeniem / wp-exhale example snippets



/**
 * This class exists so that users of Exhale can start producing xml really quickly
 */
class MyProviderName implements \Exhale\Type\XML {
    /**
     * Returns exportable apartments to Vuokraovi
     */
    static public function get_export_data() : array {
        return array('item' => 'value');
    }

    /**
     * If you need to wrap your data into custom element you can use this
     * Empty array is ignored
     */
    static public function xml_root_element() : array {
        return array(
            'name' => 'wrapper'
        );
    }

    /**
     * This function can be used to map custom namespaces into the xml
     * Empty array is ignored
     */
    static public function xml_namespaces() : array {
        return array(
            'http://www.w3.org/2001/XMLSchema-instance' => 'xsi',
        );
    }
}

define('EXHALE_URL_PREFIX','/my-custom/api/url/');

static public function get_export_data() {
        return array(
            [
                'name' => 'item',
                'attributes' => [
                    'url' => 'http://yoursite.com'
                ],
                'value' => 'value'
            ],
            [
                'name' => 'item',
                'attributes' => [
                    'url' => 'http://example.com'
                ],
                'value' => 'nothing'
            ],
        );
    }