PHP library for Yandex.Taxi API
You can use Composer
$ composer require ipinchuk/php-yandex-taxi-api
or download from GitHub
require __DIR__ . '/vendor/autoload.php';
$clientId = 'YOUR_CLIENT_ID';
$apiKey = 'YOUR_API_KEY';
$parkId = 'YOUR_PARK_ID';
$client = new IPinchuk\YandexTaxi\Client($clientId, $apiKey, $parkId);
$cars = $client->api('cars')->all();
$cars = $client->api('drivers')->all();
$profile_id = "SOME_DRIVER_PROFILE_ID";
$car_id = "SOME_CAR_ID";
$cars = $client->api('drivers')->bindVehicle($profile_id, $car_id);
$profile_id = "SOME_DRIVER_PROFILE_ID";
$car_id = "SOME_CAR_ID";
$cars = $client->api('drivers')->unbindVehicle($profile_id, $car_id);
$cars = $client->api('rules')->all();
$cars = $client->api('orders')->all();
$cars = $client->api('transactions')->all();
$cars = $client->api('transactions')->categories();
$driver_id = 'SOME_DRIVER_ID';
$cars = $client->api('transactions')->driverTransactions($driver_id);
$order_ids = ['ORDER_ID_1', 'ORDER_ID_2', 'ORDER_ID_3'];
$cars = $client->api('transactions')->orderTransactions($order_ids);
$driver_id = 'SOME_DRIVER_ID';
$amount = '-10'; // You can increase or decrease driver balance
$cad_id = 'SOME_TRANSACTION_CATEGORY_ID';
$description = 'SOME_TRANSACTION_DESCRIPTION';
$cars = $client->api('transactions')->createTransaction($driver_id, $amount, $cad_id, $description);
or
$driver_id = 'SOME_DRIVER_ID';
$amount = '10';
$cad_id = 'SOME_TRANSACTION_CATEGORY_ID';
$description = 'SOME_TRANSACTION_DESCRIPTION';
// For increase balance.
$cars = $client->api('transactions')->increaseBalance($driver_id, $amount, $cad_id, $description);
// For decrease balance
$cars = $client->api('transactions')->decreaseBalance($driver_id, $amount, $cad_id, $description);
$client->setProxy('YOR_PROXY_IP');
You need to configure API Key, Client ID and Park ID information in ClientTest.php and run the PHPUnit tests with PHPUnit
$ phpunit tests/
MIT License
Copyright (c) 2020 Igor Pinchuk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.