Download the PHP package lukedavis/gcp-api-gateway-spec without Composer

On this page you can find all versions of the php package lukedavis/gcp-api-gateway-spec. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gcp-api-gateway-spec

GCP API Gateway Spec Generator

This is a simple tool that:

The generator does not handle converting API specs (i.e., OpenAPI 3.0 to Swagger 2.0). It is assumed that you have a Swagger 2.0 spec file. If you have an API spec file in a different format, it is recommended to use api-spec-converter or another tool to convert it to Swagger 2.0.

The main use case of this tool is an intermediate step in the deployment of an API to Google Cloud Platform's API Gateway. As Google still uses the old Swagger 2.0 spec, and has additional fields that can be added/removed, this tool helps to automate the process of generating a spec file that is compatible with the API Gateway. A common use case for this tool would be on a CI pipeline:

  1. Autogenerate spec for your API
  2. Convert spec to Swagger 2.0
  3. Generate API Gateway spec file
  4. Deploy to API Gateway

Installation

Ensure you have Composer installed and available in your PATH, as well as PHP 8.0 or later.

Note for PHP 8.0: every symfony/yaml version installable on PHP 8.0 carries known (low-severity) security advisories — the 6.x line was only patched in 6.4, which requires PHP 8.1. Composer ≥ 2.9 therefore blocks resolution on PHP 8.0 by default; you would need to opt out via config.audit.block-insecure: false (at your own risk). On PHP 8.1+ this does not apply.

Local

Run the following command in your project root:

After installing, you can now run the tool using: ./vendor/bin/gcp-api-gateway-spec generate from your project root.

Global

Run the following command anywhere in your terminal:

After installing, the tool will now be in your composer installation's bin directory at <composer-home>/vendor/bin/gcp-api-gateway-spec.

You can view the path to your composer's home directory by running composer -n config --global home.

You can alias the path to the tool or add the composer vendor/bin directory to your PATH in your .zshrc or .bashrc for easier access.

Usage

Requirements

Command

Argument / option Description
input (argument) Path to the input Swagger 2.0 YAML spec file. Required.
--output, -o Where to write the generated spec. See Output path resolution.
--config, -c Path to the config file. Required.
--host Sets the top-level host of the generated spec. Optional.
--backend, -b Sets x-google-backend.address at the top level and on every operation. Optional.
--preserve-responses, -p Keep the response schemas from the input spec. By default responses are replaced with a generic 200.

Output path resolution

Examples

Absolute path with filename:

With --preserve-responses and a relative output to cwd:

Configuration

Values in the config file take precedence over the corresponding values in the input spec (info, basePath, produces, consumes, securityDefinitions, x-google-backend). Take a look at the example config for a practical example.

For each operation, the effective spec starts from path-defaults, with same-named keys replaced wholesale by the matching path-overrides.<path>.<method> entry; the operation from the input spec is then merged in recursively, winning per key (and per index for lists). Note this means an override such as security: [] cannot remove a security list the input spec itself defines — the input's entries win index-wise. It does work for the common case where security comes from path-defaults.

Normalization

Besides merging the config, the generator applies a few normalizations so that the output passes the API Gateway's Swagger 2.0 validation:

Development

Generated output is byte-compared against golden files in tests/fixtures/cases/*/expected.yaml and validated against the official Swagger 2.0 JSON schema — the same validation gcloud api-gateway api-configs create performs. After an intentional output change, regenerate goldens with UPDATE_GOLDENS=1 vendor/bin/phpunit.

Disclaimer

This tool is not officially supported by Google Cloud Platform or the API Gateway team.

This tool is provided as-is and without warranties of any kind. Luke Davis is not responsible for any security issues, vulnerabilities, or other problems that may arise from the use of this tool.

Users are responsible for ensuring the security and suitability of this tool for their specific needs and use cases. Use at your own risk.


All versions of gcp-api-gateway-spec with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
symfony/console Version ^6.0|^7.0|^8.0
symfony/yaml Version ^6.0|^7.0|^8.0
composer-runtime-api Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lukedavis/gcp-api-gateway-spec contains the following files

Loading the files please wait ...