PHP code example of premekkoch / elms-service

1. Go to this page and download the library: Download premekkoch/elms-service 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/ */

    

premekkoch / elms-service example snippets


	/** @var PremekKoch\Elms\ElmsService @inject */
	public $elmsService;

	:
	$this->elmsService->createOrder('123', 'INV_123', false, ElmsService::CURRENCY_CZK);
	$this->elmsService->addCustomer('Jan', 'Novák', 'Dlouhá 5', 'Dlouhá Lhota', '12345', ElmsService::COUNTRY_CZE);
	:

	:
	$this->elmsService->setCustomerCompany('Firma s.r.o.', '123456789', 'CZ123456789');
	$this->elmsService->setCustomerContact('[email protected]', '+420777666555');
	:

	:
	$this->elmsService->setCustomerDeliveryName('Jana', 'Nováková');
	$this->elmsService->setCustomerDeliveryAddress('Krátká 8', 'Krátká Lhota', '54321', ElmsService::COUNTRY_SVK);
	$this->elmsService->setCustomerDeliveryCompany('Jana Nováková OSVČ');
	$this->elmsService->setCustomerDeliveryContact('[email protected]', '+421777888999');
	:

	:
	$this->elmsService->addProduct('Product PLU', 1234.56, 1, 21);
	$this->elmsService->addProduct(ElmsService::DELIVERY_CPOSTRR, 55, 1, 21);
	:	

	:
	$this->elmsService->addProducts([
		[
			'plu' => 'Product PLU',
			'price' => 1234.56,
			'amount' => 1,
			'vat' => 21,
		],
		[
			'plu' => ElmsService::DELIVERY_CPOSTRR,
			'price' => 55,
			'amount' => 1,
			'vat' => 21,
		],
	]);
	:

	:
	$this->elmsService->sendOrder();
	:
	catch (PremekKoch\Elms\ElmsException $exc){
		// something goes wrong... 			
	}