PHP code example of nextvisit / claim-md-php

1. Go to this page and download the library: Download nextvisit/claim-md-php 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/ */

    

nextvisit / claim-md-php example snippets


use Nextvisit\ClaimMDWrapper\Client;
use Nextvisit\ClaimMDWrapper\Config;

$accountKey = 'your-account-key'; // Never hardcode your keys!
$config = new Config();

$client = new Client($accountKey, $config);

use Nextvisit\ClaimMDWrapper\Requests\ERARequest;
use Nextvisit\ClaimMDWrapper\DTO\ERADTO;

$eraRequest = new ERARequest($client);

// optionally pass an array or ERADTO with at least the ERA ID to get remits since then.
$eraDto = new ERADTO(eraId: 'era-id');
$recentResponse = $eraRequest->getList($eraDto);

$allResponse = $eraRequest->getList();

use Nextvisit\ClaimMDWrapper\Requests\ERARequest;

$eraRequest = new ERARequest($client);
$response = $eraRequest->get835('era-id');

use Nextvisit\ClaimMDWrapper\Requests\ERARequest;

$eraRequest = new ERARequest($client);

// optional PCN can be used after the era-id. 
$pcnResponse = $eraRequest->getPDF('era-id', 'pcn');

$regularResponse = $eraRequest->getPDF('era-id');

use Nextvisit\ClaimMDWrapper\Requests\ERARequest;

$eraRequest = new ERARequest($client);
$response = $eraRequest->getJson('era-id');

use Nextvisit\ClaimMDWrapper\Requests\FileRequest;

$fileRequest = new FileRequest($client);
$response = $fileRequest->upload(fopen('path/to/your/file.txt', 'r'));

print_r($response);

use Nextvisit\ClaimMDWrapper\Requests\FileRequest;

$fileRequest = new FileRequest($client);
$response = $fileRequest->getUploadList();

use Nextvisit\ClaimMDWrapper\Requests\ProviderRequest;
use Nextvisit\ClaimMDWrapper\DTO\ProviderEnrollmentDTO;

// If this provider is already enrolled, the response will contain that information.
$providerEnrollment = new ProviderEnrollmentDTO(
    payerId: 'payer-id',
    enrollType: 'era',
    provTaxId: 'provider-tax-id',
    provNpi: 'provider-npi',
    provNameLast: 'Doe',
    provNameFirst: 'John',
    contactEmail: '[email protected]'
);

$providerRequest = new ProviderRequest($client);
$response = $providerRequest->enroll($providerEnrollment);

use Nextvisit\ClaimMDWrapper\DTO\ClaimAppealDTO;
use Nextvisit\ClaimMDWrapper\Requests\ClaimRequest;

$appealDto = new ClaimAppealDTO(
    claimId: 'claim-id',
    remoteClaimId: 'remote-claim-id',
    contactName: 'Jane Doe',
    contactEmail: '[email protected]',
    contactPhone: '+1234567890'
);
$claimRequest = new ClaimRequest($client);
$response = $claimRequest->appeal($appealDto);

use Nextvisit\ClaimMDWrapper\Requests\ClaimRequest;

$claimRequest = new ClaimRequest($client);
$response = $claimRequest->archive('claim-id');

use Nextvisit\ClaimMDWrapper\Requests\ClaimRequest;

$claimRequest = new ClaimRequest($client);

$modId = 'mod-id'; // List modifications that have occurred after modId by specifying.
$claimMdId = 'claimmd-id'; // Get responses for a specific claim.
$field = 'some-field'; // Specify changes to a particular field.
$specifiedResponse = $claimRequest->listModifications($modId, $claimMdId, $field);

// list all modifications to all claims
$allResponse = $claimRequest->listModifications();

use Nextvisit\ClaimMDWrapper\Requests\ClaimRequest;

$claimRequest = new ClaimRequest($client);

// specify notesId to get notes since that note.
$noteId = 'note-id';
// specify claimId to get notes on just that claim.
$claimId = 'claim-id';
$specifiedResponse = $claimRequest->notes($noteId, $claimId);

// list all notes on all claims
$allResponse = $claimRequest->notes();

use Nextvisit\ClaimMDWrapper\Requests\ResponseRequest;

$responseRequest = new ResponseRequest($client);

// Get responses since responseId
$responseId = 'response-id';
$recentResponse = $responseRequest->fetchResponses($responseId);

use Nextvisit\ClaimMDWrapper\Requests\ResponseRequest;

$responseRequest = new ResponseRequest($client);

// optionally pass the claimmd-id to get responses for that id
// Note per the ClaimMD API "Do not use this option for periodic status updates".
foreach ($responseRequest->fetchAllResponses() as $response) {
    // do something with the response
    print_r($response);
}

use Nextvisit\ClaimMDWrapper\Requests\EligibilityRequest;

$eligibilityRequest = new EligibilityRequest($client);

$eligibility270 = fopen('path/to/your/file.270', 'r');

// the response will contain a 270 file
$realtimeResponse = $eligibilityRequest->checkEligibility270271($eligibility270);

use Nextvisit\ClaimMDWrapper\Requests\EligibilityRequest;
use Nextvisit\ClaimMDWrapper\DTO\EligibilityDTO;

$eligibilityRequest = new EligibilityRequest($client);

// build an EligibilityDTO or pass an existing array
$eligDto = new EligibilityDTO(
    insLastName: 'Doe',
    insFirstName: 'Jane',
    payerId: 'payer-id',
    // 18 or G8 are the only valid codes
    patientRelationship: '18',
    serviceDate: '20220203',
    providerNpi: 'provider-npi', 
    providerTaxId: 'provider-tax-id'
);

// response will be in the response array
$response = $eligibilityRequest->checkEligibilityJSON($eligDto);

use Nextvisit\ClaimMDWrapper\Requests\PayerRequest;

$payerRequest = new PayerRequest($client);

// specify a specific payer
$payerId = 'payer-id';
$specifiedPayerResponse = $payerRequest->listPayer(payerId: $payerId);

// specify a general payer name search
$payerName = 'payer-name';
$searchResponse = $payerRequest->listPayer($payerName: $payerName);

// get all payers
$allResponse = $payerRequest->listPayer();

use Nextvisit\ClaimMDWrapper\DTO\ClaimAppealDTO;

$claimAppealDto = new ClaimAppealDTO(
    claimId: '12345',
    remoteClaimId: 'remote-claim-123',
    contactName: 'John Doe',
    contactTitle: 'Claims Manager',
    contactEmail: '[email protected]',
    contactPhone: '+1-555-123-4567',
    contactFax: '+1-555-765-4321',
    contactAddr1: '123 Main St',
    contactAddr2: 'Suite 456',
    contactCity: 'Los Angeles',
    contactState: 'CA',
    contactZip: '90001'
);

// or construct from an array
$data = [
    'claimid'        => '12345',
    'remote_claimid' => 'remote-claim-123',
    'contact_name'   => 'John Doe',
    'contact_title'  => 'Claims Manager',
    'contact_email'  => '[email protected]',
    'contact_phone'  => '+1-555-123-4567',
    'contact_fax'    => '+1-555-765-4321',
    'contact_addr_1' => '123 Main St',
    'contact_addr_2' => 'Suite 456',
    'contact_city'   => 'Los Angeles',
    'contact_state'  => 'CA',
    'contact_zip'    => '90001',
];

$claimAppealDto = ClaimAppealDTO::fromArray($data);

use Nextvisit\ClaimMDWrapper\DTO\ProviderEnrollmentDTO;

$providerEnrollmentDto = new ProviderEnrollmentDTO(
    payerId: 'payer-123',
    enrollType: 'era',
    provTaxId: '123456789',
    provNpi: '9876543210',
    provNameLast: 'Doe',
    provNameFirst: 'John',
    provNameMiddle: 'M',
    contact: 'Jane Smith',
    contactTitle: 'Billing Manager',
    contactEmail: '[email protected]',
    contactPhone: '+1-555-123-4567',
    contactFax: '+1-555-765-4321',
    provId: 'provider-id-123',
    provAddr1: '123 Main St',
    provAddr2: 'Suite 100',
    provCity: 'Los Angeles',
    provState: 'CA',
    provZip: '90001'
);

// or generate from an array
$data = [
    'payerid'        => 'payer-123',
    'enroll_type'    => 'era',
    'prov_taxid'     => '123456789',
    'prov_npi'       => '9876543210',
    'prov_name_l'    => 'Doe',
    'prov_name_f'    => 'John',
    'prov_name_m'    => 'M',
    'contact'        => 'Jane Smith',
    'contact_title'  => 'Billing Manager',
    'contact_email'  => '[email protected]',
    'contact_phone'  => '+1-555-123-4567',
    'contact_fax'    => '+1-555-765-4321',
    'prov_id'        => 'provider-id-123',
    'prov_addr_1'    => '123 Main St',
    'prov_addr_2'    => 'Suite 100',
    'prov_city'      => 'Los Angeles',
    'prov_state'     => 'CA',
    'prov_zip'       => '90001',
];

$providerEnrollmentDto = ProviderEnrollmentDTO::fromArray($data);

use Nextvisit\ClaimMDWrapper\DTO\EligibilityDTO;

$eligibilityDto = new EligibilityDTO(
    insLastName: 'Doe',
    insFirstName: 'John',
    payerId: 'payer-123',
    patientRelationship: '18',
    serviceDate: '20230920',
    providerNpi: '9876543210',
    providerTaxId: '123456789',
    insMiddleName: 'M',
    serviceCode: 'SC123',
    procCode: 'PC456',
    insNumber: 'INS987654',
    insDob: '19800101',
    insSex: 'M',
    patLastName: 'Smith',
    patFirstName: 'Jane',
    patMiddleName: 'K',
    patDob: '20100101',
    patSex: 'F',
    provNameLast: 'Doe',
    provNameFirst: 'Jane',
    provTaxonomy: '207Q00000X',
    provTaxIdType: 'E',
    provAddr1: '123 Main St',
    provCity: 'Los Angeles',
    provState: 'CA',
    provZip: '90001'
);

// or convert an array to DTO
$data = [
    'ins_name_l' => 'Doe',
    'ins_name_f' => 'John',
    'payerid' => 'payer-123',
    'pat_rel' => '18',
    'fdos' => '20230920',
    'prov_npi' => '9876543210',
    'prov_taxid' => '123456789',
    'ins_name_m' => 'M',
    'service_code' => 'SC123',
    'proc_code' => 'PC456',
    'ins_number' => 'INS987654',
    'ins_dob' => '19800101',
    'ins_sex' => 'M',
    'pat_name_l' => 'Smith',
    'pat_name_f' => 'Jane',
    'pat_name_m' => 'K',
    'pat_dob' => '20100101',
    'pat_sex' => 'F',
    'prov_name_l' => 'Doe',
    'prov_name_f' => 'Jane',
    'prov_taxonomy' => '207Q00000X',
    'prov_taxid_type' => 'E',
    'prov_addr_1' => '123 Main St',
    'prov_city' => 'Los Angeles',
    'prov_state' => 'CA',
    'prov_zip' => '90001',
];

$eligibilityDto = EligibilityDTO::fromArray($data);

use Nextvisit\ClaimMDWrapper\DTO\ERADTO;

$eraDto = new ERADTO(
    checkDate: '09-01-2023',
    receivedDate: 'today',
    receivedAfterDate: '08-01-2023',
    checkNumber: '123456',
    checkAmount: '1000.00',
    payerId: 'payer-123',
    npi: '9876543210',
    taxId: '123456789',
    newOnly: '1',
    eraId: 'ERA12345',
    page: '1'
);

// or convert an array to DTO
$data = [
    'CheckDate' => '09-01-2023',
    'ReceivedDate' => 'today',
    'ReceivedAfterDate' => '08-01-2023',
    'CheckNumber' => '123456',
    'CheckAmount' => '1000.00',
    'PayerID' => 'payer-123',
    'NPI' => '9876543210',
    'TaxID' => '123456789',
    'NewOnly' => '1',
    'ERAID' => 'ERA12345',
    'Page' => '1',
];

$eraDto = ERADTO::fromArray($data);
bash
composer