cvo-technologies/cakephp-github

GitHub 的 CakePHP Web 服务实现

1.1.1 2016-08-08 00:12 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:47:46 UTC


README

Software License Build Status Coverage Status Total Downloads Latest Stable Version

安装

使用 Composer

确保在 composer.json 中存在 require。这将把插件安装到 Plugin/GitHub

{
    "require": {
        "cvo-technologies/cakephp-github": "~1.1"
    }
}

使用

如果您想获取特定仓库的信息

Web 服务配置

将以下内容添加到您的应用程序配置的 Webservice 部分。

        'git_hub' => [
            'className' => 'Muffin\Webservice\Connection',
            'service' => 'CvoTechnologies/GitHub.GitHub',
        ]

控制器

<?php

namespace CvoTechnologies\GitHub\Controller;

use Cake\Controller\Controller;
use Cake\Event\Event;

class IssuesController extends Controller
{

    public function beforeFilter(Event $event)
    {
        $this->loadModel('CvoTechnologies/GitHub.Issues', 'Endpoint');
    }

    public function index()
    {
        $issues = $this->Issues->find()->where([
            'owner' => 'cakephp',
            'repo' => 'cakephp'
        ]);

        $this->set('issues', $issues);
    }
}