承接 demroos/api-gateway-bundle 相关项目开发

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

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

demroos/api-gateway-bundle

Composer 安装命令:

composer require demroos/api-gateway-bundle

包简介

This bundle will help you make api gateway

README 文档

README

This bundle enables you to easily proxy requests. It stands as a gateway between your API and a number of external services.

About package

This package will help you create an api gateway.

Features

  • Getting endpoints from bundle configuration
  • Getting endpoints from loaders, see EndpointLoaderInterface
  • Feature for processing body request/response is coming soon

Install

composer require demroos/api-gateway-bundle

Enable bundle

in config/bundles.php

<?php

return [
    // other bundles,                            
    Demroos\Bundle\ApiGatewayBundle\ApiGatewayBundle::class => ['all' => true]    
];

add to config/routes.yml

api_gateway:
  resource: '@ApiGatewayBundle/Resources/config/routes.xml'

Config

Config endpoints

in api_gateway.yml

api_gateway:
  config:
    headers:
      - 'Content-Type'
  endpoints:
    api_example:
      url: '/api/example'
      method: 'POST'
      config:
        url: 'https://example.com/api/example'
        method: 'POST'

Load endpoint from loader

  • You create a service that implements the EndpointLoaderInterface interface
  • You add tag api_gateway.endpoint_loader for this service
<?php
namespace App\Routing;

use Demroos\Bundle\ApiGatewayBundle\Contracts\EndpointLoaderInterface;
use Demroos\Bundle\ApiGatewayBundle\Endpoint;

class ExampleEndpointLoader implements EndpointLoaderInterface
{
    public function load(): array
    {
        $endpoints = [];

        $endpoint = new Endpoint(
            'api_example',
            '/api/example',
            'POST'
        );

        $endpoints[] = $endpoint;

        return $endpoints;
    }
}

in config/services.yaml

services:
  App\Routing\ExampleEndpointLoader:
    tags: [api_gateway.endpoint_loader]

Config client factory

in api_gateway.yml

api_gateway:
  client_factory:
    #service: id_service_for_use_as_client_factory
    config:
      http_errors: false

Support PHP

ApiGatewayBundle PHP Symfony
[0.1] (develop) >=7.4 ^4.3|^5.0
[0.0] (0.0) ^7.3 ^4.3|^5.0

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固