PHP code example of sypher / keez

1. Go to this page and download the library: Download sypher/keez library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sypher / keez example snippets




use sypher\keez\KeezSDK;

$keez = new KeezSDK([
   "client_id" => "a1b2c3d4e5f6g7h8i9j10k11l12m13n1",
   "app_id"    => "vendor-abcdefghijklmnopqrtuvxz",
   "secret"    => "abcdefghijklmnopqrstuvxzw"
 ], $devmode);

$error = $keez->getLastError();

use sypher\keez\entity\Article;

$article = new Article();
$article->name = "Sample Product";
$article->code = "SKY_SAMPLE_PROD";
$article->currencyCode = "RON";
$article->measureUnitId = 1;
$article->categoryExternalId = "MISCSRV";
$article->isActive = true;

$this->keez->createArticle($article);

$article = $keez->getArticle("articleId");

$article = new stdClass();
$article->externalId = "abcdefg";
$article->name = "Sample Product Xtra Large";
$article = $keez->updateArticle($article);

$article = $keez->getArticle("articleId");
$article->name = "Sample Product Xtra Large";
$article = $keez->updateArticle($article);

$keezProducts = $keez->getArticles();

$savedInvoice = $this->keez->createInvoice($invoice);

$updatedInvoice = $this->keez->updateInvoice($invoice);

$invoice = $keez->getInvoice("3f066d8a330a4313ad02bdfd537d2c79");

$keez->deleteInvoice("3f066d8a330a4313ad02bdfd537d2c79");

$keez->validateInvoice("3f066d8a330a4313ad02bdfd537d2c79");

$keez->eFacturaInvoice("3f066d8a330a4313ad02bdfd537d2c79");

// searching for an Invoice with a specific serie and number, using array
$filter = [["series", "=", "SERIE"], ["number", 106]];
// searching for an Invoice with a specific serie and number, using string
$filter = "series[eq]:SERIE AND number[eq]:106";
// both versions have the same effect

$invoice = $keez->getInvoices($filter);

// searching for a specific Article by code
$filter = [["code", 'MY_SKU']];
$articles = $keez->getArticles($filter);