PHP code example of daaner / novaposhta

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

    

daaner / novaposhta example snippets



// Не доделал и не оттестил все модели
// используйте ветку `dev-master`
// В ней все самое последнее. Документацию стараюсь не затягивать

Daaner\NovaPoshta\NovaPoshtaServiceProvider::class,

'NovaPoshta' => Daaner\NovaPoshta\Facades\NovaPoshta::class,

$cp = new Counterparty;
$cp->setAPI('391e241b2c********************e7');

use NovaPoshta;
$model = 'TrackingDocument'; //нужная модель
$calledMethod = 'getStatusDocuments'; //нужный метод
$methodProperties = [
  //данные по документации
];
$np = new NovaPoshta;
$data = $np->getResponse($model, $calledMethod, $methodProperties, $auth = true);

dd($data);

$foo = new Common;
$list = $foo->getPaymentForms();

$bar = new Address;
$bar->setLimit(5)->setPage(2);
$cities = $bar->getCities();

dd($cities);
 bash
php artisan vendor:publish --provider="Daaner\NovaPoshta\NovaPoshtaServiceProvider"