jnonon/apigeenerator

Apigee 框架类生成器

安装: 2

依赖: 0

建议者: 0

安全: 0

星星: 2

关注者: 4

分支: 1

开放问题: 0

类型:application

dev-master 2013-02-24 02:24 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:34:06 UTC


README

此工具基于 Apigee 中现有的定义生成占位符类,例如 Apigee,例如 tumblr 控制台

功能

  • 从 API 定义生成类文件,最小化需要输入的代码量
  • 根据在 API 定义中使用的频率创建属性
  • 如果存在文档,为每个 API 方法添加 phpDoc 条目

待办事项

  • 支持其他编程语言的模板

通过 Composer 安装

  1. 需要 composer

  2. 在您的 composer.json 中添加以下行

    "require": {
        "jnonon/apigeenerator": "*"
    },
  1. 安装依赖

    php composer.phar install

  2. 需要 Composer 的自动加载器。Composer 还会准备一个自动加载文件,可以自动加载它下载的任何库中的所有类。要使用它,只需将以下行添加到您的代码启动过程中

    require 'vendor/autoload.php';

使用示例

    <?php
    /* redditApiGeenerator.php */
    require __DIR__.'/vendor/autoload.php';
    
    use Jnonon\Tools\ApiGeenerator\Client\ApiGeenerator;
    
    $apigee = new ApiGeenerator('reddit', 'RedditApi');
    
    $apigee->setApigeeSourceUrl($url);
    
    $endpoints = $apigee->getEndpoints();
    
    //Write to a path, overriding if exists
    //$apigee->generateClassForEndpoint($endpoints[0])->write('/desirable/filesystem/path', true);
    
    echo $apigee->generateClassForEndpoint($endpoints[0])->toString();
    
    //See results
    //php redditApiGeenerator.php

示例输出在 Examples\RedditApi.php