Download the PHP package phprise/grogu-gateway without Composer

On this page you can find all versions of the php package phprise/grogu-gateway. 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 grogu-gateway

phprise/grogu-gateway

A generic gateway for Symfony/ApiPlatform applications based on the OTAKU Manifesto.

What it does

Grogu is a single entry point in front of many ApiPlatform services. It discovers each service's OpenAPI document at runtime, aggregates every route into one map, and forwards incoming requests to the service that owns the route.

Given enma=https://enma.io and nami=https://nami.io, a request to POST grogu.io/api/order is forwarded to POST nami.io/api/order.

How it works

  1. Bootstrap: reads the GROGU_SERVICES environment variable and builds a ServiceRegistry.
  2. Discovery: for every service, fetches {host}/api/docs.json and extracts its operations.
  3. Aggregation: builds a RouteMap. If two services expose the same method and path, an AmbiguousRouteException is thrown and the gateway refuses to start.
  4. Routing: resolves the incoming request against the map and forwards it to the owner.

Discovery happens on every request, so any change in a service's documentation is reflected immediately without restarting the gateway.

Configuration

Services are configured through the GROGU_SERVICES environment variable as a comma-separated list of name=host pairs:

The host is the origin only (scheme + domain). The path to the OpenAPI document is configured separately through GROGU_SPEC_PATHS, a comma-separated list of candidate paths tried in order until one returns a valid JSON document:

This makes the gateway flexible across frameworks: an API Platform service may expose /api/docs.json, while another may expose /docs.json. If GROGU_SPEC_PATHS is not set, it defaults to /api/docs.json.

Different environments can expose different hosts, or omit services entirely (for example, authentication in a development environment).

Authentication

Authentication is optional and pluggable. By default it is disabled (GROGU_AUTH_MODE=none), and the gateway forwards every request untouched.

When enabled, the gateway authenticates the request before forwarding it. The authenticator is a generic HTTP adapter: it extracts a token from a request header, calls a verification URL, and interprets the JSON response. This means the same adapter works with any verification service (KoenmaID, Keycloak, a custom one).

Environment variables

Variable Default Description
GROGU_AUTH_MODE none none (disabled) or http (generic HTTP adapter)
GROGU_AUTH_URL — The verification URL the gateway calls
GROGU_AUTH_HEADER Authorization The request header that carries the token
GROGU_AUTH_PUBLIC_ROUTES — Comma-separated routes that skip authentication

The verification contract

The gateway sends a POST to GROGU_AUTH_URL with a JSON body:

The verification service must answer with:

Any other shape (or valid: false) results in a 401.

Example: KoenmaID

Example: Keycloak (same adapter)

Custom authenticators

For cases the HTTP adapter does not cover, implement Phprise\GroguGateway\Domain\Contract\AuthenticatorInterface and wire it in public/index.php through an AuthenticationGate.

Running

Testing

Philosophy

We follow The OTAKU Manifesto: Fluid Structure Design. Please read more about it in OTAKU Manifesto. See our security policy in SECURITY.md.


All versions of grogu-gateway with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
phprise/http Version ^2.0
phprise/common Version ^2.0
guzzlehttp/psr7 Version ^2.8
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 phprise/grogu-gateway contains the following files

Loading the files please wait ...