承接 czahoo/api-framework 相关项目开发

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

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

czahoo/api-framework

最新稳定版本:v1.1.12

Composer 安装命令:

composer require czahoo/api-framework

包简介

Basic light weight framework for external or internal APIs

README 文档

README

After installing module using composer, you need to follow steps below:

  1. Add content of src/.htaccess to your .htaccess file or just copy it to your root directory if u don't have one
  2. Create basic folder for your API (by default it should be named 'Api')
  3. Create application folder inside your Api (by default it should be named 'App')
  4. Create Routing.php file where you put your routing config with basic structure as defined below:
  5. Implement 'show' method in your basic controller which will be called by default if no other method is passed
  6. Create index.php file with code as presented below
  7. To call default method in your basic controller type yoursitename.com/api/ (for external api) or yoursitename.com/internal_api/ (for internal api)
  8. To call method 'test' in your custom controller for internal api type yoursitename.com/api/custom_route/test

File: index.php

// Register vendor autoloader
require_once '../vendor/autoload.php';

// Start application
session_start();
Framework::detectContext($_GET['API_TYPE']);
Framework::translateUrl($_GET['URL']);
Framework::run();

File: Routing.php

$FRAMEWORK_ROUTING = array(
    Framework::API_TYPE_EXTERNAL => array(
        Framework::DEFAULT_CONTROLLER_ROUTE_NAME => 'Api\App\Basic\Controller\BasicControllerName',
        'custom_route' => 'Api\App\Path\To\Your\Controller',
    ),
    Framework::API_TYPE_INTERNAL => array(
        Framework::DEFAULT_CONTROLLER_ROUTE_NAME => 'Api\App\Basic\Controller\BasicControllerName',
    ),
);

统计信息

  • 总下载量: 197
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-04