dynamics-tools/dynamics-web-api-php-wrapper

There is no license information available for the latest version (1.0.1.1) of this package.

PHP 8.1 wrapper for Microsoft Dynamics Web API

1.0.1.1 2024-07-17 20:28 UTC

This package is auto-updated.

Last update: 2024-09-17 20:48:17 UTC


README

Introduction

This package is not intended to be an in-depth SDK for Microsoft Dynamics. Its main purpose is to simplify the process of authentication and request setup for users of Dynamics Web API.

Authentication

We utilize server-to-server OAuth authentication via an application user. To successfully authenticate, you'll need to set the following environment variables:

APPLICATION_ID: Application (Client) ID

APPLICATION_SECRET: Application (Client) Secret

TENANT_ID: Tenant ID

INSTANCE_URL: Dynamics (Instance) URL

API Documentation

The API documentation for this version of the Dynamics Web API can be found here.

Usage Example

Ensure the environment variables are set before running the example.

Using the Client

use DynamicsWebApi\Client;
use DynamicsWebApi\ClientFactory;

require_once 'vendor/autoload.php';

$client = Client::createInstance();
$response = $client->request('/CloneAsSolution', 'POST', [
'ParentSolutionUniqueName' => 'MySolution',
'DisplayName' => 'MySolution',
'VersionNumber' => '1.12.0.0'
]);

$responseJson = json_decode($response->getBody()->getContents(), true);
echo $responseJson['SolutionId'];

Using the Helper

use DynamicsWebApi\Helper;

require_once 'vendor/autoload.php';

$helper = new Helper();
$helper->updateEntity('pluginassemblies', '38938383-383838-392912-192882', ['name' => 'MyPluginAssembly'], '9.2');
$helper->publishAllChanges();