Skip to content

Responses

Response classes wrap API responses and provide typed access to data.

Base Class

Response

Abstract base class for all response classes.

php
namespace OxygenSuite\OxygenErgani\Responses;

abstract class Response
{
    use HasAttributes;

    public function __construct(mixed $attributes = []);
    abstract protected function processData(): void;
}

All response classes extend Response and implement processData() to map API data to properties.


Authentication

AuthenticationToken

Response from authentication requests.

php
namespace OxygenSuite\OxygenErgani\Responses;

class AuthenticationToken extends Response

Properties:

PropertyTypeDescription
accessTokenstring|nullBearer token for API requests
refreshTokenstring|nullToken for refreshing access
accessTokenExpiresAtDateTimeImmutable|nullAccess token expiration time
refreshTokenExpiresAtDateTimeImmutable|nullRefresh token expiration time

Example:

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani();
$token = $ergani->authenticate('username', 'password');

echo $token->accessToken;
echo $token->refreshToken;
echo $token->accessTokenExpiresAt->format('Y-m-d H:i:s');

// Check if token is still valid
if ($token->accessTokenExpiresAt > new DateTimeImmutable()) {
    echo "Token is valid";
}

Submission Responses

SubmissionResponse

Base response for document submissions.

php
namespace OxygenSuite\OxygenErgani\Responses;

class SubmissionResponse extends Response

Properties:

PropertyTypeDescription
idstring|nullUnique submission ID
protocolstring|nullProtocol number (e.g., 'Ε3Ν123')
submissionDateDateTimeInterface|nullDate and time of submission

Example:

php
foreach ($response as $result) {
    echo "ID: {$result->id}\n";
    echo "Protocol: {$result->protocol}\n";
    echo "Date: {$result->submissionDate->format('d/m/Y H:i:s')}\n";
}

WorkCardResponse

Response for work card submissions. Extends SubmissionResponse.

php
namespace OxygenSuite\OxygenErgani\Responses;

class WorkCardResponse extends SubmissionResponse

Inherits all properties from SubmissionResponse.

Example:

php
use OxygenSuite\OxygenErgani\Http\Documents\WorkCard\WorkCard;

$responses = (new WorkCard($token))->handle($cards);

foreach ($responses as $response) {
    echo $response->protocol;  // e.g., 'WKC123456'
}

WorkTimeResponse

Response for work time declarations. Extends SubmissionResponse.

php
namespace OxygenSuite\OxygenErgani\Responses;

class WorkTimeResponse extends SubmissionResponse

Inherits all properties from SubmissionResponse.


OvertimeResponse

Response for overtime declarations. Extends SubmissionResponse.

php
namespace OxygenSuite\OxygenErgani\Responses;

class OvertimeResponse extends SubmissionResponse

Inherits all properties from SubmissionResponse.


Service Responses

EmployerResponse

Response from EmployerInfo service.

php
namespace OxygenSuite\OxygenErgani\Responses;

class EmployerResponse extends Response

Properties:

PropertyTypeDescription
idstring|nullEmployer ID in ERGANI
tinstring|nullTax identification number (AFM)
namestring|nullLegal name (Επωνυμία)
amestring|nullAME registration number
isInCardSectorbool|nullWhether employer must submit work cards

Example:

php
use OxygenSuite\OxygenErgani\Http\Services\EmployerInfo;

$employer = (new EmployerInfo($token))->handle();

echo $employer->name;
echo $employer->tin;

if ($employer->isInCardSector) {
    echo "Work cards required";
}

BranchResponse

Response item from BranchInfo service.

php
namespace OxygenSuite\OxygenErgani\Responses;

class BranchResponse extends Response

Properties:

PropertyTypeDescription
aastring|nullBranch sequence number (0 = HQ)
addressstring|nullBranch address

ParameterResponse

Response item from ParameterLookup service.

php
namespace OxygenSuite\OxygenErgani\Responses;

class ParameterResponse extends Response

Properties:

PropertyTypeDescription
codestring|nullParameter code
descriptionstring|nullHuman-readable description
extrastring|nullAdditional information

Example:

php
$param = $collection->find('001');
echo $param->code;        // "001"
echo $param->description; // "ΕΛΛΑΔΑ"
echo $param->extra;       // Additional data if available

EmployeeStatusResponse

Response item from MonthlyStatus service. Contains comprehensive monthly employment data.

php
namespace OxygenSuite\OxygenErgani\Responses;

class EmployeeStatusResponse extends Response

Identification Properties:

PropertyTypeDescription
employerIdstring|nullEmployer ID
branchAastring|nullBranch sequence number
yearint|nullReport year
monthint|nullReport month
employeeTypestring|nullEmployee type (e.g., "Εξαρτημένη")
afmstring|nullTax ID
amkastring|nullSocial security number (AMKA)
amastring|nullIKA insurance number
lastNamestring|nullLast name (Επώνυμο)
firstNamestring|nullFirst name (Όνομα)
fatherNamestring|nullFather's name
motherNamestring|nullMother's name
birthDateDateTimeInterface|nullBirth date
sexstring|nullSex
nationalitystring|nullNationality code with description
maritalStatusstring|nullMarital status
childrenCountint|nullNumber of children
educationLevelstring|nullEducation level

Employment Properties:

PropertyTypeDescription
characterizationstring|nullEmployee type (Υπάλληλος/Εργάτης)
employmentRelationstring|nullEmployment relation (Αορίστου/Ορισμένου)
employmentStatusstring|nullFull/Part time (Πλήρης/Μερική)
specialtystring|nullSpecialty code with description
salarystring|nullGross salary (Greek format)
weeklyHoursstring|nullWeekly work hours
hourlyWagestring|nullHourly wage
programstring|nullEmployment program
responsiblestring|nullResponsible person
hiringDateDateTimeInterface|nullHiring date

Work Day Properties:

PropertyTypeDescription
workDaysint|nullDays worked on-site
remoteWorkDaysint|nullDays worked remotely
restDaysint|nullRest/repo days
nonWorkingDaysint|nullNon-working days

Leave Day Properties:

PropertyTypeDescription
annualLeaveDaysint|nullAnnual leave days
bloodDonationLeaveDaysint|nullBlood donation leave
examLeaveDaysint|nullExam leave
unpaidLeaveDaysint|nullUnpaid leave
maternityLeaveDaysint|nullMaternity leave
maternityProtectionDaysint|nullMaternity protection days
paternityLeaveDaysint|nullPaternity leave
childCareLeaveDaysint|nullChild care leave days
parentalLeaveDaysint|nullParental leave days
caregiverLeaveDaysint|nullCaregiver leave
forceMajeureDaysint|nullForce majeure days
assistedReproductionLeaveDaysint|nullAssisted reproduction leave
prenatalExamLeaveDaysint|nullPrenatal exam leave
marriageLeaveDaysint|nullMarriage leave
seriousChildIllnessLeaveDaysint|nullSerious child illness leave
childHospitalizationLeaveDaysint|nullChild hospitalization leave
singleParentLeaveDaysint|nullSingle parent leave
schoolPerformanceLeaveDaysint|nullSchool performance leave
childIllnessLeaveDaysint|nullChild illness leave
violenceAbsenceDaysint|nullViolence/harassment absence
sicknessDaysint|nullSick days
disabilityLeaveDaysint|nullDisability leave
bereavementLeaveDaysint|nullBereavement leave
minorStudentLeaveDaysint|nullMinor student leave
bloodTransfusionDaysint|nullBlood transfusion/dialysis days
kanepGseeLeaveDaysint|nullKANEP-GSEE training leave
aidsLeaveDaysint|nullAIDS-related leave
flexibleWorkDaysint|nullFlexible work arrangement days
otherLeaveDaysint|nullOther leave types

Minute-Based Leave Properties:

PropertyTypeDescription
childCareMinutesint|nullChild care leave (minutes)
parentalLeaveMinutesint|nullParental leave (minutes)
forceMajeureMinutesint|nullForce majeure (minutes)
flexibleWorkMinutesint|nullFlexible work (minutes)
prenatalExamMinutesint|nullPrenatal exam (minutes)
schoolPerformanceMinutesint|nullSchool performance (minutes)
otherLeaveMinutesint|nullOther leave (minutes)
totalMinutesint|nullTotal leave minutes

Overtime & Work Card Properties:

PropertyTypeDescription
overtimeMinutesint|nullTotal overtime minutes
overtimeDaysint|nullDays with overtime
workCardDaysint|nullDays with work card entries
sundayHolidayDaysint|nullSunday/holiday work days
sundayHolidayCardDaysint|nullSunday/holiday card days

Insurance Properties:

PropertyTypeDescription
totalInsuredLeaveDaysint|nullTotal insured leave days
totalInsuredSicknessDaysint|nullTotal insured sickness days

Example:

php
use OxygenSuite\OxygenErgani\Http\Services\MonthlyStatus;

$employees = (new MonthlyStatus($token))->handle(2025, 1);

foreach ($employees as $emp) {
    echo "{$emp->lastName} {$emp->firstName}\n";
    echo "AFM: {$emp->afm}, AMKA: {$emp->amka}\n";
    echo "Hired: {$emp->hiringDate->format('d/m/Y')}\n";
    echo "Work days: {$emp->workDays}, Remote: {$emp->remoteWorkDays}\n";
    echo "Salary: {$emp->salary}, Weekly hours: {$emp->weeklyHours}\n";
}

Collections

Collection

Abstract base class for typed collections.

php
namespace OxygenSuite\OxygenErgani\Responses;

abstract class Collection implements ArrayAccess, Countable, IteratorAggregate

Methods:

MethodReturn TypeDescription
find($key)object|nullFind item by key
has($key)boolCheck if key exists
filter(callable $callback)staticFilter items with callback
keys()arrayGet all keys
values()arrayGet all values
count()intGet item count
first()object|nullGet first item
last()object|nullGet last item
isEmpty()boolCheck if empty

BranchCollection

Collection of BranchResponse objects.

php
namespace OxygenSuite\OxygenErgani\Responses;

class BranchCollection extends Collection

Additional Methods:

MethodReturn TypeDescription
search(string $query)BranchCollectionSearch by address (case-insensitive)
toDropdown()arrayGet [aa => address] for dropdowns

Example:

php
use OxygenSuite\OxygenErgani\Http\Services\BranchInfo;

$branches = (new BranchInfo($token))->handle();

// Find HQ
$hq = $branches->find('0');

// Search by address
$athensOffices = $branches->search('ΑΘΗΝΑ');

// For HTML select
$options = $branches->toDropdown();

// Iterate
foreach ($branches as $aa => $branch) {
    echo "Branch {$aa}: {$branch->address}\n";
}

ParameterCollection

Collection of ParameterResponse objects.

php
namespace OxygenSuite\OxygenErgani\Responses;

class ParameterCollection extends Collection

Additional Methods:

MethodReturn TypeDescription
search(string $query)ParameterCollectionSearch by description (case-insensitive)
toDropdown()arrayGet [code => description] for dropdowns
codes()arrayGet all codes

Example:

php
use OxygenSuite\OxygenErgani\Http\Services\ParameterLookup;

$nationalities = (new ParameterLookup($token))
    ->handle(ParameterLookup::NATIONALITY);

// O(1) lookup
$greek = $nationalities->find('001');
// or
$greek = $nationalities['001'];

// Check existence
if ($nationalities->has('001')) {
    echo "Found Greek nationality";
}

// Search descriptions
$results = $nationalities->search('ΕΛΛΑ');

// Filter with callback
$euCountries = $nationalities->filter(
    fn($p) => in_array($p->code, ['001', '002', '003'])
);

// For dropdown
$dropdown = $nationalities->toDropdown();
// ['001' => 'ΕΛΛΑΔΑ', '002' => 'ΑΛΒΑΝΙΑ', ...]

// Get all codes
$codes = $nationalities->codes();

Using Array Access

Collections support array-style access:

php
// Access by key
$branch = $branches['0'];
$nationality = $nationalities['001'];

// Check existence
if (isset($branches['1'])) {
    // Branch 1 exists
}

// Count
echo count($branches);

// Iteration
foreach ($branches as $key => $branch) {
    echo "{$key}: {$branch->address}\n";
}

See Also

Released under the MIT License.