Skip to content

KopeechkaStore/Kopeechka-PHP-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kopeechka PHP library

PHP version / Documentation EN / Документация RU

Documentation EN





Документация RU






Work with kopeechka api

Click for api documentation

Installation


For exists vendor

  1. Add /KopeechkaLib to folder /vendor/.
  2. Add "KopeechkaLib\\": "KopeechkaLib/" to composer.json like:
{
"autoload": {
    "psr-4": {
      "KopeechkaLib\\": "KopeechkaLib/"
    }
  }
}
  1. Include or required .../vendor/autoload.php at file usage.

For file

  1. Download at folder .../kopeechka.
  2. Use command at this folder:
compser dump-autoload --optimize
  1. Include or required .../vendor/autoload.php at file usage.


Работа с копеечкой api

Кликните, чтобы прочитать api документацию

Установка


Для существующей папки vendor

  1. Добавьте "KopeechkaLib\\": "KopeechkaLib/" в composer.json, где .... - уже добавленные пакеты, как показано ниже:
{
   "autoload": {
       "psr-4": {
         ....,
         "KopeechkaLib\\": "KopeechkaLib/"
      }
   }
}
  1. Include или require файл .../vendor/autoload.php в нужный вам.

Для отдельного файла/скрипта

  1. Скачать в папку .../kopeechka.
  2. Необходимо установить авто-загрузчик через композер командой:
compser dump-autoload --optimize
  1. Include или require файл .../vendor/autoload.php в нужный вам.


Work with Library | Работа с Библиотекой


$token = 'WFAgJqysjqFXbWyjXPOCBmEnimdKVURm';
$api_version = '2';
$response_type = 'json';
    
$kopeechka = new KopeechkaApi($token, $api_version,$response_type);


Get balance by token | Запрос баланса:

$response_balance = $kopeechka
        ->user()
        ->balance();

$response_decoded = json_decode($response_balance, true);

if ($response_decoded['status'] == 'OK') {
   echo $response_decoded_balance['balance'];
} else {
   echo "\n" . $response_decoded['value'];
}


Get email for site | Запрос почты:

$site = 'test.com';
$mail_type = 'all';
$password = 0;
$regex = null;
$subject = null;
$investor = null;
$soft = null;

$response_get_email = $kopeechka
   ->mailbox()
   ->getEmail($site, $mail_type, $password, $regex, $subject, $investor, $soft);

if ($response_get_email) {
   $response_get_email = json_decode($response_get_email, true);
} else {
   die("\nEmpty response_get_email");
}

$email = null;
$id = null;

if ($response_get_email['status'] == 'OK') {
   $email = $response_get_email['mail'];
   $id = $response_get_email['id'];

   exit("\n" . $response_get_email['mail']);
} else {
   die("\nBad response: " . $response_get_email['value']);
}

Get Message for activation ID | Запрос письма:

$id = 223512;
$full = true;

$response_get_message = $kopeechka
   ->mailbox()
   ->getMessage($id, $full);

if ($response_get_message) {
   $response_get_message = json_decode($response_get_email, true);
} else {
   die("\nEmpty response_get_message");
}

if ($response_get_message['status'] == 'OK') {
   exit("\n" . $response_get_message['fullmessage']);
} elseif ($response_get_message['value'] == 'WAIT_LINK') {
   exit("\nWait message");
} else {
   die("\nBad response: " . $response_get_message['value']);
}

Cancel email activation | Отменить почту:

$id = 223512;

$response_cancel_activation = $kopeechka
   ->mailbox()
   ->cancel($id);

Reorder email activation | Повторный запрос активации с этой почтой:

$site = 'test.com';
$email = 'test@email.com';
$password = 0;
$regex = null;
$subject = null;
$investor = null;
$soft = null;

$response_get_email = $kopeechka
   ->mailbox()
   ->reorder($site, $email, $password, $regex, $subject, $investor, $soft);

Fresh activation id | Узнать ID активации по почте и сайту:

$site = 'test.com';
$email = 'test@email.com';

$response_get_email = $kopeechka
   ->mailbox()
   ->getFreshId($site, $email);


List of all service domains | Получить наши домены:

$response_domains = $kopeechka
        ->mailbox()
        ->getDomains();

    if ($response_domains) {
        $response_domains = json_decode($response_domains, true);

        echo print_r($response_domains['domains'],1);
    } else {
        throw new Exception("\nEmpty response_balance");
    }

Get prices and zones | Получить цены и зоны:

$site = 'test.com';
$popular = true;

$response_domains = $kopeechka
   ->mailbox()
   ->zones($popular, $site);

if ($response_domains) {
   $response_domains = json_decode($response_domains, true);
   
   exit(print_r($response_domains['zones'], 1));
} else {
   die("\nEmpty response_balance");
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages