1. Go to this page and download the library: Download beziworld/laravel-nfz 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/ */
beziworld / laravel-nfz example snippets
use Beziworld\Nfz\Facades\Nfz;
use Beziworld\Nfz\Enums\ChildAgeRange;
use Beziworld\Nfz\Query\QueueSearch;
$search = QueueSearch::for('PORADNIA KARDIOLOGICZNA') // full-text fragment, e.g. "kardiolog"
->in('mazowieckie') // code "07", name or Province::Mazowieckie
->locality('WARSZAWA')
->urgent() // stable is the default
->forChildren(ChildAgeRange::UpTo3); // or forAdults()
foreach (Nfz::waitingTimes()->search($search)->take(50) as $queue) { // LazyCollection, pages of 25
$queue->benefit; // "PORADNIA KARDIOLOGICZNA"
$queue->provider; // provider name, ->providerCode, ->providerNip, ->providerRegon
$queue->place->name; // "PORADNIA KARDIOLOGICZNA DLA DZIECI"
$queue->place->address; // "DALEKA 11", ->locality, ->county, ->latitude, ->longitude
$queue->place->bookingPhone(); // registration phone, otherwise the general one
$queue->place->accessibility->elevator; // true / false / null (no information)
$queue->forecast->text; // predicted waiting time as published, e.g. "14 dni"
$queue->forecast->days; // 14
$queue->forecast->expectedDate(); // CarbonImmutable
$queue->statistics->awaiting; // people on the list at the end of the month
$queue->statistics->averageWaitDays;
}
$page = Nfz::waitingTimes()->searchPage(['benefit' => 'ortoped', 'province' => '12'], page: 2, limit: 25);
$page->total; $page->lastPage(); $page->hasMorePages();
$queue = Nfz::waitingTimes()->queue($id); // null for an unknown id
$other = Nfz::waitingTimes()->otherPlaces($id); // the same benefit in other places of the provider
$check = Nfz::ewus()->check('79060804378'); // validated locally first; nothing is sent for a malformed PESEL
$check->status; // InsuranceStatus::Insured, NotInsured, NotFound (not in CWU), PeselAnnulled
$check->isInsured();
$check->validUntil; // day of the confirmation
$check->firstName; // "ImięTAK", ->lastName, ->fullName()
$check->prescriptionMark; // "DN" for entitled persons under 18, ->hasDnMark()
$check->additionalInfo; // list of AdditionalInfo: code ("PESEL-UKR-DOROSLY"), level (Information/Warning), value
$check->operationId; // "L1712M01200000001"
$check->checkedAt;
$check->document; // the signed NFZ confirmation (status_cwu_odp XML), cut byte for byte for archiving
$check->maskedPesel(); // "********378", use it in logs
Nfz::ewus()->isInsured($pesel);
Nfz::ewus()->check($pesel, fresh: true); // ignore the result cached for today
Nfz::ewus()->login(); // Session: ->messageCode, ->passwordExpiresInDays
Nfz::ewus()->logout();
Nfz::ewus()->changePassword('new password'); // also changes the password in the branch portal
Nfz::ewus()->changeExpiredPassword('new password'); // after login threw PasswordExpired
use Beziworld\Nfz\Rules\InsuredInNfz;
$request->validate(['pesel' => ['onfirm the entitlement
(new InsuredInNfz())->connection('lab'); // named eWUS connection
bash
php artisan nfz:check-insurance 79060804378 # PESEL masked in the output; exit code 1 when not insured
php artisan nfz:check-insurance 79060804378 --with-name --connection=lab --fresh
php artisan nfz:waiting-times kardiolog --province=mazowieckie --locality=WARSZAWA --urgent --limit=20
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.