strambm / cybersoft-i6-api
CybersoftI6Api
1.0.4
2024-10-21 08:52 UTC
Requires
- php: ^7.0 || ^8.0
- nesbot/carbon: ^1.26.3 || ^2.0 || ^3.0
README
Instalace
Composer
Pro instalaci balíčku je nutné jej instalovat skrze composer.
composer require strambm/cybersoft-i6-api
Ukázka užití
SynchronizaceProduktu
ResultByCode
<?php
require_once __DIR__ . '/vendor/autoload.php';
use CybersoftI6Api\CybersoftI6Api;
use CybersoftI6Api\Connection\Login;
use CybersoftI6Api\Connection\RequestMethod;
use CybersoftI6Api\Models\ResultTypes\StoItemBase as ReturnModel; //Pokud máte jiné nastavení u dodavatele, stačí předědit model a dát zde do use;
/*
apiUrl = http://JMENO:HESLO@WWW.CYBERSOFT.CZ/i6ws/Default.asmx;
urlApiDomain = 'http://WWW.CYBERSOFT.CZ'
*/
$login = new Login('username', 'password', 'urlApiDomain');
$api = new CybersoftI6Api($login);
$stoBaseItems = $api->call(ReturnModel::class, RequestMethod::BY_CODE, ['code' => '123456']);
$item = \current($stoBaseItems);
Result
<?php
require_once __DIR__ . '/vendor/autoload.php';
use CybersoftI6Api\CybersoftI6Api;
use CybersoftI6Api\Connection\Login;
use CybersoftI6Api\Connection\RequestMethod;
use CybersoftI6Api\Models\ResultTypes\StoItemBase as ReturnModel;
$login = new Login('username', 'password', 'urlApiDomain');
$api = new CybersoftI6Api($login);
$stoBaseItems = $api->call(ReturnModel::class, RequestMethod::GET_RESULT);
Synchronizace Faktur
ResultByFromTo
<?php
require_once __DIR__ . '/vendor/autoload.php';
use CybersoftI6Api\CybersoftI6Api;
use CybersoftI6Api\Connection\Login;
use CybersoftI6Api\Connection\RequestMethod;
use CybersoftI6Api\Models\ResultTypes\DocTrInv as ReturnModel;
use Carbon\Carbon;
$login = new Login('username', 'password', 'urlApiDomain');
$api = new CybersoftI6Api($login);
$stoBaseItems = $api->call(ReturnModel::class, RequestMethod::BY_FROM_TO, ['from' => Carbon::today()->subDays(14), 'to' => Carbon::today()]);
Result
Nevrátí Vám výpis všech faktur, ale jen všech faktur z daného dne.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use CybersoftI6Api\CybersoftI6Api;
use CybersoftI6Api\Connection\Login;
use CybersoftI6Api\Connection\RequestMethod;
use CybersoftI6Api\Models\ResultTypes\DocTrInv as ReturnModel;
$login = new Login('username', 'password', 'urlApiDomain');
$api = new CybersoftI6Api($login);
$stoBaseItems = $api->call(ReturnModel::class, RequestMethod::GET_RESULT);