Skip to content
php finance
PHP Other
  1. PHP 98.8%
  2. Other 1.2%
Branch: master
Clone or download
tangw197 tangw197
tangw197 and tangw197 drop the php 7.1 support
Latest commit 4a0f453 Feb 13, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin update package Feb 13, 2020
spec add fixer test Jun 17, 2019
src add all api Oct 15, 2019
.gitignore
.phpspec.yml 修改命名空间,改名Monster为Lightfly,使名字更加具有亲和力,也意喻“轻量,快速” May 21, 2019
.travis.yml drop the php 7.1 support Feb 13, 2020
LICENSE add GPL-3 license May 23, 2019
api.http init commit May 17, 2019
composer.json update package Feb 13, 2020
composer.lock
readme.md 添加板块数据 Jun 7, 2019

readme.md

金融数据服务

GitHub Packagist Version Build Status

Quality gate

安装

composer require guzzlehttp/guzzle
composer require lightfly/finance

使用

基本使用

<?php
use GuzzleHttp\Client;
use Lightfly\Finance\HttpClient;
use Lightfly\Finance\Stock\Stock;

$httpClient = new HttpClient(new Client());

$stock = new Stock($httpClient);
$data = $stock->HS300();

var_dump($data);

高级

如果不喜欢 guzzle 或者主机配置的原因,可以替换 http client 的实现,只要继承 HttpClientInterface 实现相应的 get 和 post 方法即可,示例:

class AnotherHttpClient implements HttpClientInterface
{
    public function get($url, $options = [])
    {
        return file_get_contents($url);
    }
}

$httpClient = new AnotherHttpClient();

$stock = new Stock($httpClient);
$data = $stock->HS300();

var_dump($data);

Run tests

bin/phpspec run
You can’t perform that action at this time.