定制 appwrite/sdk-generator 二次开发

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

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

appwrite/sdk-generator

最新稳定版本:1.8.9

Composer 安装命令:

composer require appwrite/sdk-generator

包简介

Appwrite PHP library for generating API SDKs for multiple programming languages and platforms

README 文档

README

Discord Build Status Twitter Account Follow Appwrite on StackShare appwrite.io

WORK IN PROGRESS - NOT READY FOR GENERAL USAGE

Appwrite SDK generator is a PHP library for auto-generating SDK libraries for multiple languages and platforms.

The SDK Generator uses predefined language settings as Twig templates to generate codebases based on different API specs.

Currently, the only spec supported is Swagger 2.0, but we intend to add support for more specifications in the near future. This generator is still lacking support for any definition/model specs.

Getting Started

Install using composer:

CLI

composer update --ignore-platform-reqs --optimize-autoloader

Docker (UNIX)

docker run --rm --interactive --tty --volume "$(pwd)":/app composer install --ignore-platform-reqs

Docker (Windows)

docker run --rm --interactive --tty --volume "%cd%":/app composer install --ignore-platform-reqs

Create language and SDK instances and generate code to target directory.

<?php

require_once 'vendor/autoload.php';

use Appwrite\Spec\Swagger2;
use Appwrite\SDK\SDK;
use Appwrite\SDK\Language\PHP;

// Read API specification file (Swagger 2) and create spec instance
$spec = new Swagger2(file_get_contents('https://appwrite.io/v1/open-api-2.json?extension=1'));

// Create language instance
$lang = new PHP();

$lang // Set language or platform specific options
    ->setComposerPackage('my-api')
    ->setComposerVendor('my-company')
;

// Create the SDK object with the language and spec instances
$sdk  = new SDK($lang, $spec);

$sdk
    ->setLogo('https://appwrite.io/v1/images/console.png')
    ->setLicenseContent('License content here.')
    ->setVersion('v1.1.0')
;

$sdk->generate(__DIR__ . '/examples/php'); // Generate source code

Linting Twig Templates

This project uses djLint to lint Twig template files for syntax and common issues.

Note: Formatting is disabled as it breaks code generation syntax. Only linting is used.

Available command:

composer lint-twig  # Check for linting errors

Requires uv to be installed. Configuration is in pyproject.toml. The linter runs automatically on pull requests via GitHub Actions.

Supported Specs

Supported Client / Platform SDKs

Language Supported Versions Coding Standards Package Manager Maintainer
Web ES5+ NPM Coding Style NPM, Yarn, @eldadfux
Flutter Effective Dart pub tool @bartektartanus @Almoullim @lohanidamodar
Android (Kotlin, Java) 5.0+ Android style guide Gradle, Maven @abnegate
iOS, macOS (Swift) iOS 15+, macOS 11+ Swift Style Guide Swift Pkg Manager @abnegate
Unity (Csharp) ? You?

Supported Server SDKs

Language Supported Versions Coding Standards Package Manager Contributors
TypeScript NPM Coding Style NPM, Yarn @eldadfux
NodeJS 8, 10, 12 NPM Coding Style NPM, Yarn @eldadfux
PHP 7.0+ PHP FIG Composer @eldadfux
Ruby 2.4+ Ruby Style Guide GEM @eldadfux @abnegate
Python 3.5+ PEP8 PIP @eldadfux @abnegate
Dart 2.7+ Effective Dart pub @lohanidamodar
Go Effective Go go get @panz3r [@phaus]
.NET .NET core 3.1 C# Coding Conventions NuGet @komemi @TorstenDittmann
D ? You?
Kotlin 1.4.31+ Kotlin style guide Gradle, Maven @abnegate
Java 8+ Google style guide Gradle, Maven @abnegate
Swift 5.5+ Swift Style Guide Swift Pkg Manager @abnegate
Docker CLI Docker Hub @christyjacob4

Contributing

All code contributions, including those by people with commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.

Copyright and license

The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php

统计信息

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

GitHub 信息

  • Stars: 306
  • Watchers: 21
  • Forks: 192
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-23