Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Api Gateway Bundle Laravel Package

demroos/api-gateway-bundle

View on GitHub
Deep Wiki
Context7

ApiGatewayBundle

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
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui