PHP code example of oxygensuite / oxygen-ergani

1. Go to this page and download the library: Download oxygensuite/oxygen-ergani 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/ */

    

oxygensuite / oxygen-ergani example snippets


use OxygenSuite\OxygenErgani\Storage\FileToken;
use OxygenSuite\OxygenErgani\Storage\Token;
use OxygenSuite\OxygenErgani\Enums\Environment;

Token::setCurrentTokenManager(
    new FileToken('your-username', 'your-password'),
    Environment::TEST // or Environment::PRODUCTION
);

use OxygenSuite\OxygenErgani\Ergani;
use OxygenSuite\OxygenErgani\Models\WorkCard\Card;
use OxygenSuite\OxygenErgani\Models\WorkCard\CardDetail;
use OxygenSuite\OxygenErgani\Enums\CardDetailType;

$card = Card::make()
    ->setEmployerTin('999999999')
    ->setBranchCode(0)
    ->setComments('')
    ->addDetails(
        CardDetail::make()
            ->setTin('888888888')
            ->setLastName('DOE')
            ->setFirstName('JOHN')
            ->setType(CardDetailType::CHECK_IN)
            ->setReferenceDate(date('Y-m-d'))
            ->setDate(date('Y-m-d\TH:i:s.uP'))
    );

$ergani = new Ergani();
$response = $ergani->sendWorkCards($card);

echo $response[0]->protocol; // e.g., 'ΕΥΣ92'

use OxygenSuite\OxygenErgani\Ergani;
use OxygenSuite\OxygenErgani\Models\Hiring\NewDeclaration;

$declaration = NewDeclaration::make()
    ->setEmployerTin('999999999')
    ->setBranchCode(0)
    ->setLastName('ΠΑΠΑΔΟΠΟΥΛΟΣ')
    ->setFirstName('ΙΩΑΝΝΗΣ')
    ->setTin('888888888')
    ->setAmka('01018012345')
    ->setHiringDate('15/01/2025')
    // ... additional fields
    ->withDefaults(); // Fill remaining fields with empty strings

$ergani = new Ergani();
$response = $ergani->sendHiringNew($declaration);