PHP code example of nalognl / megaplan-module

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

    

nalognl / megaplan-module example snippets


\Nalognl\MegaplanModule\Config::new()->load([
    'plugin_path' => '/var/www/html/wp-content/plugins/nalognl_megaplan',
    'cache_dir_path' => '/var/www/uploads/global-storage/cache',
    'megaplan_host' => getenv('NNND_HOST'),
    'megaplan_login' => getenv('NNND_LOGIN'),
    'megaplan_password' => getenv('NNND_PASSWORD'),
    'megaplan_hash_password' => getenv('NNND_MD5_HASH_PASSWORD'),
    'megaplan_api1_auth_uri' => getenv('NNND_AUTH_URI'),
    'megaplan_api3_auth_uri' => getenv('NNND_API3_AUTH_URI'),
]);

public function getOffers(array $data): array
{
    $uri = $this->getEnvOrThrow('NNND_OFFERS_LIST_URI');

    $res = $this->request->post($uri, $data);
    $this->throwIfError($res, 'API1: При попытке взять товары с мегаплана');

    return $res->data->offers;
}