PHPackages                             pdeans/miva-provision - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pdeans/miva-provision

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

pdeans/miva-provision
=====================

Miva remote provision PHP library.

v2.1.3(3y ago)1135MITPHPPHP ^5.4 || ^7.0 || ^8.0

Since Jul 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mivaprofsrvcs/miva-provision)[ Packagist](https://packagist.org/packages/pdeans/miva-provision)[ RSS](/packages/pdeans-miva-provision/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (3)Versions (8)Used By (0)

> This package is **abandoned** and no longer maintained.

Miva Remote Provision
---------------------

[](#miva-remote-provision)

PHP library consisting of a full toolkit for interacting with Miva's remote provisioning module. The library components include tools for creating Miva provision xml markup, sending provision xml requests, and capturing provision xml responses.

### Installation

[](#installation)

Install via [Composer](https://getcomposer.org/).

```
composer require pdeans/miva-provision
```

### Usage

[](#usage)

First, create a new "Provision" manager instance. The manager instance takes 3 required parameters:

1. **Store Code** - Store Settings &gt; Store Code
2. **XML Request URL** - Domain Settings &gt; Remote Provisioning &gt; XML Request URL
3. **Access Token** - Domain Settings &gt; Remote Provisioning &gt; Access Token

```
use pdeans\Miva\Provision\Manager as Provision;

$store_code = 'PS';
$url = 'http://www.example.com/mm5/json.mvc?Function=Module&Module_Code=remoteprovisioning&Module_Function=XML';
$token = '12345';

$prv = new Provision($store_code, $url, $token);
```

Once the manager instance has been created, it may be used to generate provision xml markup, as well as send provision requests.

### Creating Provision XML Tags

[](#creating-provision-xml-tags)

The library utilizes the simple and extensive pdeans [XML Builder](https://github.com/pdeans/xml-builder) package to easily generate Miva provisioning tags.

#### Using The Provision Tag Builder

[](#using-the-provision-tag-builder)

The `create` method is used to generate a provision xml tag. The `create` method takes the name of the root element (provisioning tag name) as the first argument, and an associative array consisting of the data to build the root attribute elements and/or child elements as the second argument.

Here is a simple example:

```
$xml = $prv->create('Category_Add', [
    '@tags' => [
        'Code' => 'Tools',
        'Name' => $prv->cdata('Class Tools and Skill Kits'),
    ],
]);
```

This will produce the following xml:

```

    Tools
    Class Tools and Skill Kits]]>

```

#### Parent/Child Elements

[](#parentchild-elements)

Notice how the array key-values function under the `@tags` array from the above example. The keys represent the xml element names, and the values represent the xml element values. Child tags can also be nested following this pattern with the parent element represented by the array key, and the array value consisting of an array of the child elements as key-value pairs. This pattern can be repeated as needed to nest subsequent child elements.

#### Element Value Helpers

[](#element-value-helpers)

The `cdata` helper method can be used to wrap an element value in a `` tag, while the `decimal` helper method can be used to format a decimal number into a standard decimal format, rounding to 2 decimals by default and stripping out commas. The `decimal` helper method accepts an optional second parameter to set the precision.

```
// Output:
echo $prv->cdata('Class Tools and Skill Kits');

// Output: 49.00
echo $prv->decimal(49.0000000);

// Output: 49.001
echo $prv->decimal(49.0005, 3);
```

#### Reserved Keys

[](#reserved-keys)

The `@tags` key represents one of 3 reserved keys (each containing shortcut key counterparts) that the xml builder uses to parse and generate the xml. The reserved keys are as follows:

**@attributes Key***Shortcut: **@a***

The `@attributes` key is used to create xml element attributes. The `@a` key is also supported as a shortcut for the `@attributes` key.

Examples:

```
$xml = $prv->create('CategoryProduct_Assign', [
    '@attributes' => [
        'category_code' => 'Food',
        'product_code'  => 'ale-gallon',
    ],
]);

$xml = $prv->create('CategoryProduct_Assign', [
    '@a' => [
        'category_code' => 'Food',
        'product_code'  => 'ale-gallon',
    ],
]);
```

XML Produced:

```

```

**@tags Key***Shortcut: **@t***

The `@tags` key accepts an associative array of data to build the root element's children. The `@t` key is also supported as a shortcut for the `@tags` key.

Examples:

```
$xml = $prv->create('ProductAttribute_Add', [
    '@a' => [
        'product_code' => 'chest',
    ],
    '@tags' => [
        'Code'   => 'lock',
        'Type'   => 'select',
        'Prompt' => $prv->cdata('Lock'),
    ],
]);

$xml = $prv->create('ProductAttribute_Add', [
    '@a' => [
        'product_code' => 'chest',
    ],
    '@t' => [
        'Code'   => 'lock',
        'Type'   => 'select',
        'Prompt' => $prv->cdata('Lock'),
    ],
]);
```

XML Produced:

```

    lock
    select
    Lock]]>

```

**@value Key***Shortcut: **@v***

The `@value` key explicitly sets an xml element value. Generally, this is only required on xml elements that require both attributes and a value to be set. The `@v` key is also supported as a shortcut for the `@value` key.

Examples:

```
$xml = $prv->create('Module', [
    '@attributes' => [
        'code' => 'customfields',
        'feature' => 'fields_prod',
    ],
    '@tags' => [
        'ProductField_Value' => [
            '@attributes' => [
                'product' => 'chest',
                'field' => 'armor_type',
            ],
            '@value' => 'wood',
        ],
    ],
]);

$xml = $prv->create('Module', [
    '@a' => [
        'code' => 'customfields',
        'feature' => 'fields_prod',
    ],
    '@t' => [
        'ProductField_Value' => [
            '@a' => [
                'product' => 'chest',
                'field' => 'armor_type',
            ],
            '@v' => 'wood',
        ],
    ],
]);
```

XML Produced:

```

    wood

```

Note that the `@tags` key is used on the first level only of the associative array of tag data, as it represents the child tag data, while the other two reserved keys can be used on any sub-level throughout the associative array.

#### Repeated Tags

[](#repeated-tags)

Sometimes repeated tags are used in xml, which does not play nice with associative array key-value pairs. To circumvent this, the element name is still passed as the array key, however, the array value consists of a sequential array of arrays with the tag data.

```
$xml = $prv->create('Order_Add', [
    '@t' => [
        'Charges' => [
            'Charge' => [
                [
                    'Type' => 'SHIPPING',
                    'Description' => 'Shipping: UPS Ground',
                    'Amount' => 5.95
                ],
                [
                    'Type' => 'TAX',
                    'Description' => 'Sales Tax',
                    'Amount' => 2.15
                ],
            ],
        ],
    ],
]);
```

XML Produced:

```

            SHIPPING
            Shipping: UPS Ground
            5.95

            TAX
            Sales Tax
            2.15

```

#### Self-closing Tags

[](#self-closing-tags)

To generate a self-closing element without attributes, pass a value of *null* as the array value.

```
$xml = $prv->create('Order_Add', [
    '@t' => [
        'TriggerFulfillmentModules' => null,
    ],
]);
```

XML Produced:

```

```

### Sending Provision Requests

[](#sending-provision-requests)

Provision requests are sent via the `send` method.

```
$response = $prv->send($xml);
```

By default, the `send` method will automatically prepend the `Store` (with the current store code) and `Provision` tags to the xml data passed to the method. If you wish for the functionality to be ommited, simply pass *true* as the second parameter.

```
$response = $prv->send($xml, true);
```

### Append Tag Helpers

[](#append-tag-helpers)

The following append helpers can be used to help prepare the provision request xml for sending. As noted above, the `send` method will call the `addStore` and `addProvision` helper methods by default to auto-prepare the xml data before sending.

```
// Appends  element to xml
$xml = $prv->addDomain($xml);

// Appends  element to xml
$xml = $prv->addStore($xml);

// Appends  element to xml
$xml = $prv->addProvision($xml);
```

### Provision Responses

[](#provision-responses)

A response object is returned with each provision request via the `send` method. The response object is an instance of the Zend Framework's [Diactoros](https://zendframework.github.io/zend-diactoros/) response object, which implements the [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP message interface.

### Helper Methods

[](#helper-methods)

The manager instance also includes helper methods to easily return or swap out the store code, request url, or access token as needed. Helper method examples:

```
// Get store code
$store_code = $prv->getStore();

// Set store code
$prv->setStore('store code');

// Get provision request url
$url = $prv->getUrl();

// Set provision request url
$prv->setUrl('request url');

// Get provision access token
$token = $prv->getToken();

// Set provision access token
$prv->setToken('access token');
```

### Version Notes

[](#version-notes)

Version 2 currently requires PHP 5.4 or higher, however, version 1 can be used if support for PHP 5.3 is required.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~356 days

Recently: every ~533 days

Total

7

Last Release

1123d ago

Major Versions

v1.x-dev → v2.0.02017-07-30

PHP version history (4 changes)v1.0.2PHP &gt;=5.3.3

v2.0.0PHP &gt;=5.6

v2.1.0PHP ^5.4 || ^7.0

v2.1.2PHP ^5.4 || ^7.0 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7277991?v=4)[Patrick Stearns](/maintainers/pdeans)[@pdeans](https://github.com/pdeans)

![](https://avatars.githubusercontent.com/u/135266743?v=4)[mivaprofsrvcs](/maintainers/mivaprofsrvcs)[@mivaprofsrvcs](https://github.com/mivaprofsrvcs)

---

Top Contributors

[![pdeans](https://avatars.githubusercontent.com/u/7277991?v=4)](https://github.com/pdeans "pdeans (43 commits)")

---

Tags

provisionMivaMiva provisionMiva remote provisionremote provision

### Embed Badge

![Health badge](/badges/pdeans-miva-provision/health.svg)

```
[![Health](https://phpackages.com/badges/pdeans-miva-provision/health.svg)](https://phpackages.com/packages/pdeans-miva-provision)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
