- Saved searches
- Use saved searches to filter your results more quickly
- License
- AlexaCRM/dynamics-webapi-toolkit
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- CrixuAMG/microsoft-business-dynamics-sdk
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Как использовать PHP для работы с Microsoft Dynamics 365
- Похожие записи:
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Dynamics 365 Web API Toolkit for PHP
License
AlexaCRM/dynamics-webapi-toolkit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
The Dynamics Web API Toolkit provides an easy-to-use PHP wrapper for the Dynamics 365 Customer Engagement Web API.
Create, read, update and delete CRM records easily via the IOrganizationService — compatible interface, as well as execute Web API actions and functions.
See the tutorial for the sample code to instantiate the connection, create, retrieve, update and delete records.
This toolkit supports only Dynamics 365 Web API. For PHP implementation of the Dynamics 365 SOAP interface, see php-crm-toolkit project.
The current release of the library does not support the following features (supported features and scenarios are mentioned along the way):
- Authentication support for IFD and On-Premises (AD) deployments. Support for IFD (Internet Facing Deployment) is on the roadmap, On-Premises deployments (using AD) are under consideration.
- Execute method of IOrganizationService interface is not supported yet. Means for executing functions and actions, both bound and unbound, are provided though.
- Batch requests are not supported yet. That means, associating/disassociating multiple records is executed in multiple separate requests which may affect the performance.
- Organization metadata (entities and attributes, global option sets, etc.) is not supported yet, although can be retrieved manually via the built-in OData helper client or via the HTTP client.
- Most of the record attribute values are returned as-is from Web API. That means, at this point you must expect integers in place of OptionSetValue objects for picklist values, Status/State attributes, booleans for «Two Options» attributes, and floats for decimal and Money attributes. Lookup attribute values are rendered as EntityReference objects. The same applies when you set values in the Entity, including EntityReferences. This is likely to change once organization metadata is integrated into the toolkit.
The main requirement is PHP 7.4 or later. cURL is recommended but is not required. Composer is required to install the toolkit and its dependencies.
$ composer require alexacrm/dynamics-webapi-toolkit:dev-master
See the Tutorial to learn how to consume the library.
- David Yack’s Xrm.Tools.CRMWebAPI — some code was borrowed as OData helper code
- Guzzle — an extensible PHP HTTP client
Currently the toolkit code is not tagged. Once the library is stable API-wise, we will use SemVer for versioning.
This project is licensed under the MIT License — see the LICENSE.md file for details.
About
Dynamics 365 Web API Toolkit for PHP
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Microsoft Dynamics 365 SDK for PHP
License
CrixuAMG/microsoft-business-dynamics-sdk
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Get started with the Saint Systems Microsoft Dynamics 365 SDK for PHP
This SDK is currently in preview. Please continue to provide feedback as we iterate towards a production-supported library.
For WordPress users, please see our Gravity Forms Dynamics 365 Add-On.
You can install the PHP SDK with Composer.
Get started with Microsoft Dynamics 365
Register your application
Register your application to use the Microsoft Dynamics 365 API by using one of the following supported authentication portals:
- Microsoft Azure Active Directory: Register a new application in your tenant’s Active Directory to support work or school users for your tenant, or multiple tenants.
- Microsoft Application Registration Portal (Coming Soon): Register a new application that authenticates using the v2.0 authentication endpoint. This endpoint authenticates both personal (Microsoft) and work or school (Azure Active Directory) accounts.
Authenticate with the Microsoft Graph service
The Microsoft Dynamics 365 SDK for PHP does not include any default authentication implementations. Instead, you can authenticate with the library of your choice.
When authenticating, you simply need to request access to your Dynamics 365 instance URL using the resource parameter of Azure AD.
Call Microsoft Dynamics 365
The following is an example that shows how to call Microsoft Dynamics 365 Web API.
use Microsoft\Dynamics\Dynamics; use Microsoft\Dynamics\Model; class UsageExample $instanceUrl = 'https://contoso.crm.dynamics.com'; $accessToken = 'xxx'; $dynamics = new Dynamics(); $dynamics->setInstanceUrl($instanceUrl) ->setAccessToken($accessToken); $leads = $dynamics->createRequest("GET", "/leads") ->setReturnType(Model\Lead::class) ->execute(); $lead = $leads[0]; echo "Hello, I am $lead->getFirstName() "; // OR GET a specific lead by ID $lead = $dynamics->createRequest("GET", "/leads(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)") ->setReturnType(Model\Lead::class) ->execute(); echo "Hello, I am $lead->getFirstName() "; >
Run vendor/bin/phpunit from the base directory.
Documentation and resources
View or log issues on the Issues tab in the repo.
Copyright (c) Saint Systems, LLC. All Rights Reserved. Licensed under the MIT license.
About
Microsoft Dynamics 365 SDK for PHP
Как использовать PHP для работы с Microsoft Dynamics 365
PHP — один из самых популярных языков программирования в веб-разработке. И вот, если вы хотите взаимодействовать с Microsoft Dynamics 365, PHP может стать отличным выбором.
Microsoft Dynamics 365 — это программное обеспечение для управления отношениями с клиентами (CRM), которое позволяет компаниям автоматизировать их процессы продаж, маркетинга и обслуживания клиентов. Для взаимодействия с системой можно использовать API (Application Programming Interface) — набор инструкций, которые позволяют приложению взаимодействовать с другими приложениями.
Существует два основных способа взаимодействия с Dynamics 365 API с помощью PHP:
1. Использование RESTful API
RESTful API — это HTTP-интерфейс, который позволяет получить доступ к данным и методам Dynamics 365. Это подход к проектированию API, который является стандартом в веб-разработке.
Пример кода для получения информации о контакте из Dynamics 365:
$endpoint = 'https://.crm4.dynamics.com/api/data/v9.1/contacts(00000000-0000-0000-0000-000000000000)'; $authHeader = [ 'Authorization: Bearer ' . $accessToken, 'OData-MaxVersion: 4.0', 'OData-Version: 4.0', 'Accept: application/json', 'Content-Type: application/json', ]; $ch = curl_init($endpoint); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $authHeader); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
В этом примере мы используем CURL для выполнения запроса к RESTful API Dynamics 365. Мы передаем заголовки авторизации и получаем ответ, который декодируется из JSON в массив PHP.
2. Использование неуправляемого C# кода
Неуправляемый код — это код, который написан на языке программирования C# и компилируется в библиотеку (.dll). Вы можете использовать неуправляемый код для взаимодействия с Dynamics 365 API и затем вызывать его из PHP-скрипта.
Пример кода для создания контакта в Dynamics 365 с помощью неуправляемого C# кода:
using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Client; public class ContactService < private IOrganizationService _service; public ContactService(IOrganizationService service) < _service = service; >public void CreateContact(string firstName, string lastName) < Entity contact = new Entity("contact"); contact["firstname"] = firstName; contact["lastname"] = lastName; _service.Create(contact); >>
Здесь мы определяем класс ContactService, который содержит метод CreateContact для создания нового контакта в Dynamics 365. Прежде чем вызвать этот метод из PHP-скрипта, мы компилируем его в библиотеку (.dll) и затем загружаем ее в PHP с помощью функции `dl`.
$contactService = 'ContactService'; $contactServicePath = '/path/to/dll/ContactService.dll'; dl($contactServicePath); $service = new \OrganizationServiceProxy('.crm4.dynamics.com', $username, $password); $contact = new $ContactService($service); $contact->CreateContact('John', 'Doe');
Здесь мы загружаем библиотеку ContactService.dll, создаем proxy-сервис для Dynamics 365, затем создаем экземпляр ContactService и вызываем метод CreateContact.
Как видите, PHP может быть отличным выбором для взаимодействия с Dynamics 365. Вы можете выбрать любой из этих подходов в зависимости от ваших потребностей и навыков. Но в любом случае, знание PHP и Dynamics 365 API может значительно упростить вашу работу с CRM-системой.