1. Go to this page and download the library: Download nks-hub/nette-ares 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/ */
nks-hub / nette-ares example snippets
use NksHub\NetteAres\AresClient;
use NksHub\NetteAres\AresException;
class MyPresenter extends Nette\Application\UI\Presenter
{
public function __construct(
private AresClient $ares,
) {}
public function actionDetail(string $ico): void
{
try {
$result = $this->ares->findByIco($ico);
echo $result->obchodniJmeno; // "Asseco Central Europe, a.s."
echo $result->ico; // "27074358"
echo $result->dic; // "CZ27074358"
echo $result->getStreet(); // "Budějovická 778/3a"
echo $result->getCity(); // "Praha - Michle"
echo $result->getFormattedPsc(); // "140 00"
echo $result->kodStatu; // "CZ"
} catch (AresException $e) {
$this->flashMessage($e->getMessage(), 'danger');
}
}
}