Skip to content

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

License

Notifications You must be signed in to change notification settings

komemi/sdk-generator

 
 

Repository files navigation

Appwrite SDK Generator

Build Status Discord

WORK IN PROGRESS - NOT READY FOR GENERAL USAGE

Appwrite SDK generator is a PHP library for auto generating SDK library for multiple languages or platforms.

The SDK uses predefined language settings and Twig templates to generate code base on different API specs.

Currently the only spec supported is Swagger 2.0, but we intend to add support for more specification in the near future.

Examples

You can view examples of generated code libraries in the examples directory.

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

Docker (Windows)

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

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) anc 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

Supported Specs

Supported Languages

Language Supported Versions Coding Standards Package Manager Maintainer
Javascript ES5+ NPM Coding Style NPM, Yarn, @eldadfux
TypeScript NPM Coding Style NPM, Yarn You?
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
Python 3.5+ PEP8 PIP @eldadfux
Dart Effective Dart pub tool @bartektartanus @Almoullim
Go Effective Go go get @panz3r
CSharp .NET core 3.1 C# Coding Conventions ? @komemi
D ? You?
Kotlin ? You?
Swift Swift Pkg Manager @armino-dev

Contributing

All code contributions - including those of people having commit access - must go through a pull request and 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

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 53.7%
  • HTML 40.8%
  • TypeScript 1.3%
  • C# 1.2%
  • Java 0.9%
  • JavaScript 0.6%
  • Other 1.5%