Code Monkey home page Code Monkey logo

ares's Introduction

Downloads this Month Latest Stable Version Coverage Status Total Downloads License

More information about versions is in changelog.

Support development by QR code

Use QR code or sponsor button where is link on my revolut.

Thank you :)

QR payment

Installation to project

The best way to install h4kuna/ares is using Composer:

composer require h4kuna/ares

# optional and default support
composer require guzzlehttp/guzzle

Download information about customer via his IN.

ARES

Homepage documentation for developers.

Load data by one identification number.

use h4kuna\Ares;
$ares = (new Ares\AresFactory())->create();
try {
    $response = $ares->loadBasic('87744473');
    /* @var $response Ares\Ares\Core\Data */
    var_dump($response);
} catch (Ares\Exceptions\IdentificationNumberNotFoundException $e) {
    // log identification number, why is bad? Or make nothing.
} catch (Ares\Exceptions\ServerResponseException $e) {
    // no response from server or broken json
}

Load data by many identification numbers. Limit by ARES service is set to 100 items, but library chunk it and check duplicity.

use h4kuna\Ares;
/** @var Ares\Ares $ares */
$numbers = ['one' => '25596641', 'two' => '26713250', 'three' => '27082440', 'four' => '11111111'];

try { 
    foreach ($ares->loadBasicMulti($numbers) as $name => $r) {
        var_dump($name, $r->company);
    }
} catch (Ares\Exceptions\ServerResponseException $e) {
    // no response from server or broken json
}

Other endpoints

Choose endpoint from class Sources.

  • SERVICE_* - available other endpoints
  • CORE - is main endpoint this is used in method $ares->loadBasic()
  • DIAL - use if you want list of value for example PravniForma
  • SER_NO_* are not exists
use h4kuna\Ares;

/** @var Ares\Ares $ares */
$result = $ares->getAresClient()->useEndpoint(Ares\Ares\Sources::SERVICE_VR, '27082440');
var_dump($result);

Dials

Parameters kodCiselniku and zdrojCiselniku you can find in json file, on this page AresRestApi-verejne_v*.json, like a ciselnikKod: PravniForma, zdroj: res.

use h4kuna\Ares;

/** @var Ares\Ares $ares */
$result = $ares->getAresClient()->searchEndpoint(Ares\Ares\Sources::DIAL, [
	'kodCiselniku' => 'PravniForma',
	'zdrojCiselniku' => 'res',
])->ciselniky[0]->polozkyCiselniku;

foreach ($result as $item) {
	var_dump($item);
}

Data Box (datová schánka)

Manual

use h4kuna\Ares;
/** @var Ares\Ares $ares */
try {
    $response = $ares->loadDataBox('87744473');
    var_dump($response->ISDS);
} catch (h4kuna\Ares\Exceptions\ServerResponseException $e) {
    // catch error
}

VIES

Support base check.

use h4kuna\Ares;
/** @var Ares\Ares $ares */

try {
    $response = $ares->checkVatVies($vatNumber);
    var_dump($response->valid); // true / false
} catch (Ares\Exceptions\ServerResponseException $e) {
    // invalid VAT
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.