定制 php-gear/auto-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

php-gear/auto-client

Composer 安装命令:

composer require php-gear/auto-client

包简介

A command-line tool to generate Javascript client-side APIs from REST PHP APIs

README 文档

README

A command-line tool to generate Javascript client-side APIs from REST PHP APIs

Introduction

This package provides a command-line tool for use either with the Laravel framework (as an Artisan command) or with the Electro framework (as a Workman command).

TO DO: provide an explanation of the rationale behind this library and some usage examples.

Note: currently, this tool generates code for use with AngularJS 1.x, and it expects an Angular service called remote of type RemoteService.

This requirement is temporary and it will be removed on a later version of this tool.

Documentation

Additional documentation will be written, as soon as I find the time for it.

Installation

Runtime requirements

  • PHP >= 7.0
  • AngularJS 1.x
Optionally, one of
  • Laravel >= 4.2
  • Electro >= 1.0

Installing on Laravel

On the command-line, type:

composer require php-gear/auto-client

Register the Artisan command on artisan.php:

Artisan::resolve (PhpGear\AutoClient\Laravel\AutoClientCommand::class);

Installing on Electro

workman install php-gear/auto-client

Usage

On Laravel

Configuring

On config/app.php, define the APIs to be exported to Javascript.

Example:

return [
  'autoclient' => [
    'APIs' => [
      // Endpoint URL => [controller class, target directory, Angular module name] 
      'API/something' => [SomethingController::class, 'App/remote', 'App'],
    ],
  ],
  ///... the rest of the existing file
];

Running the generator

artisan autoclient:generate

On Electro

Running the generator

workman autoclient:generate

License

This library is open-source software licensed under the MIT license.

See the accompanying LICENSE file.

Copyright © 2018 Cláudio Silva

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-24