1. Go to this page and download the library: Download rebasesoftware/edm-efatura 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/ */
rebasesoftware / edm-efatura example snippets
DM\EFatura\Client;
use EDM\EFatura\Exception\EDMSoapException;
use EDM\EFatura\Invoice\Invoice;
use EDM\EFatura\Invoice\Element\Company;
use EDM\EFatura\Invoice\Element\Line;
use EDM\EFatura\Invoice\Element\Product;
use EDM\EFatura\Invoice\Element\Tax;
use EDM\EFatura\Invoice\Element\PaymentType;
// Initialize client
$client = new Client(
'https://test.edmbilisim.com.tr/EFaturaEDM21ea/EFaturaEDM.svc?singleWsdl',
'your_username',
'your_password',
'your_hostname',
'your_reason',
'your_channel',
'your_application'
);
// Login
try {
if ($client->login()) {
echo "Login successful!";
$sessionId = $client->getSessionId();
echo "Session ID: " . $sessionId;
} else {
echo "Login failed";
}
} catch (EDMSoapException $e) {
echo "Login error: " . $e->getMessage();
}
// Create and configure invoice
$invoice = new Invoice();
$invoice->setProfileId('TICARIFATURA');
$invoice->setId('INV-001');
// ... configure other invoice properties
$result = $client->sendInvoice($invoice);
// $result contains 'request' and 'response' arrays
// Get by invoice number
$invoice = $client->getInvoice('INV-001');
// Get by UUID
$invoice = $client->getInvoice(null, 'uuid-12345');
// Get incoming invoice
$incomingInvoice = $client->getInvoice('INV-001', null, true);