fortecdev/trending-github

一个简单的包,用于获取Github上的热门仓库。

1.0.0 2017-12-19 13:48 UTC

This package is not auto-updated.

Last update: 2024-09-19 02:59:25 UTC


README

此包是 此模块 的PHP版本。

安装

composer require fortecdev/trending-github

使用

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

use Fortec\GithubTrending;

$github = new GithubTrending();

$data = $github->getTrending();

var_dump($data);
/*
[
    [
        'author' => 'facebook',
        'name' => 'react',
        'url' => 'https://github.com/facebook/react',
        'description' => 'A declarative, efficient, and flexible JavaScript library for building user interfaces.',
        'language' => 'JavaScript',
        'stars' => '83,511',
        'forks' => '15,791',
        'starsToday' => '25 stars today'
    ],
    ...
]
*/

您还可以添加时间周期和语言过滤器。

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

use Fortec\GithubTrending;

$github = new GithubTrending("weekly","php");

$data = $github->getTrending();

var_dump($data);
/*
[
    [
        'author' => 'laravel',
        'name' => 'laravel',
        'url' => 'https://github.com/laravel/laravel',
        'description' => 'A PHP Framework For Web Artisans',
        'language' => 'JavaScript',
        'stars' => '36,921',
        'forks' => '12,145',
        'starsToday' => '200 stars this week'
    ],
    ...
]
*/

许可证

MIT许可证 (MIT)

版权所有 © 2017 Olumide Falomo