承接 zerodha/phpkiteconnect 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zerodha/phpkiteconnect

最新稳定版本:v5.0.0

Composer 安装命令:

composer require zerodha/phpkiteconnect

包简介

The PHP client library for the Kite Connect trading APIs Resources

README 文档

README

The Official PHP client for communicating with the Kite Connect API.

Note: For PHP version < 8.0. You can refer to our previous version.
Kite Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio and more, with the simple HTTP API collection.

Zerodha Technology (c) 2025. Licensed under the MIT License.

Documentation

Installing

Requirements

  1. Install PHP version 8.0 or higher.
  2. Install Composer, which is used to install PHP packages.

You can install the package via composer:

composer require zerodha/phpkiteconnect

Note: You can refer to our previous version here for PHP version < 8.0.

Usage

<?php
    require_once __DIR__ . '/vendor/autoload.php';

    use KiteConnect\KiteConnect;

    // Initialise.
    $kite = new KiteConnect("your_api_key");

    // Assuming you have obtained the `request_token`
    // after the auth flow redirect by redirecting the
    // user to $kite->getLoginURL()
    try {
        $user = $kite->generateSession("request_token_obtained", "your_api_secret");
        echo "Authentication successful. \n";
        print_r($user);
        $kite->setAccessToken($user->access_token);
    } catch(Exception $e) {
        echo "Authentication failed: ".$e->getMessage();
        throw $e;
    }

    echo $user->user_id." has logged in";

    // Get the list of positions.
    echo "Positions: \n";
    print_r($kite->getPositions());

    // Place order.
    $order = $kite->placeOrder("regular", [
        "tradingsymbol" => "INFY",
        "exchange" => "NSE",
        "quantity" => 1,
        "transaction_type" => "BUY",
        "order_type" => "MARKET",
        "product" => "NRML"
    ]);

    echo "Order id is ".$order->order_id;
?>

Examples

Check examples folder for more examples.

Refer to the PHP client documentation for the complete list of supported methods.

Run unit tests

composer test

Generate documentation

$ apt-get install wget
$ wget https://phpdoc.org/phpDocumentor.phar
$ chmod +x phpDocumentor.phar
$ ./phpDocumentor.phar run -d ./src/ -t ./doc/

Changelog

Check CHANGELOG.md

统计信息

  • 总下载量: 3.14k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 46
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 46
  • Watchers: 5
  • Forks: 30
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-07