Package OData is designed to connect to REST API "1C:Enterprise" using the OData protocol.
Via Composer
$ composer require vvasystem/o-data
$connection = ConnectionFactory::getInstance('http:https://localhost/test/odata/standard.odata', 'test', 'test');
TestTable.php
use OData\Client\Table;
class TestTable extends Table
{
/**
* @inheritdoc
*/
protected $_name = 'Catalog_Склады';
/**
* @inheritdoc
*/
protected $_primary = 'Ref_Key';
}
$table = new TestTable(['connection' => $connection]);
$resultRow = $table->insert([
'Code' => 'Test',
'Discription' => 'Test',
]);
\var_dump($resultRow);
array(3) {
["Ref_Key"]=> string(36) "31b2c19f-e241-11e6-8108-005056a77adb"
["Code"]=> string(5) "Test"
["Discription"]=> string(5) "Test"
}
$resultRow = $table->update([
'Code' => 'Test1',
'Discription' => 'Test1',
], '31b2c19f-e241-11e6-8108-005056a77adb');
$table->delete('31b2c19f-e241-11e6-8108-005056a77adb');
// For getting count of entries
$count = $table->count();
// Running RPC
$result = $table->call('SelectChanges', [
'DataExchangePoint' => 'http:https://localhost/1c/odata/standard.odata/ExchangePlan_Обмен(guid'9d586f0e-afec-11e7-be8e-b888e3a9a739')',
'MessageNo' => '123456',
]);
The MIT License (MIT).