polysource / adapter-http
Polysource — HTTP REST API adapter: list, browse, write external API resources through the admin (with cursor or page-based pagination strategies).
Package info
github.com/polysource/adapter-http
Type:symfony-bundle
pkg:composer/polysource/adapter-http
Requires
- php: >=8.1
- polysource/core: ^0.1
- symfony/config: ^5.4 || ^6.0 || ^7.0 || ^8.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0 || ^8.0
- symfony/http-client: ^5.4 || ^6.0 || ^7.0 || ^8.0
- symfony/http-kernel: ^5.4 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.5
- polysource/symfony-bundle: 0.1.x-dev
This package is auto-updated.
Last update: 2026-05-10 21:01:31 UTC
README
HTTP REST API adapter for Polysource — admin Stripe, GitHub, internal microservices, any external REST API you operate but don't own the schema of.
Part of the Polysource monorepo. MIT-licensed.
What it ships
HttpDataSource— implementsWritableDataSourceInterfaceover SymfonyHttpClientInterface.PaginationStrategyInterface— pluggable pagination protocol with two built-in implementations:PageNumberPaginationStrategy—?page=Nstyle (Stripe-like)CursorPaginationStrategy— opaque cursor in response (GitHub-like)
defaultHeadersconstructor arg for injecting auth headers (Bearer tokens, API keys).HttpResource— non-final convenience base.- Tested with Symfony's
MockHttpClientso no live API calls in CI.
Install
composer require polysource/adapter-http symfony/http-client
Register the bundle:
return [ Polysource\Adapter\Http\PolysourceAdapterHttpBundle::class => ['all' => true], ];
Extend it
For an API that paginates in an unusual way (link headers, X-Pagination, RFC 5988…), implement PaginationStrategyInterface (2 methods):
final class LinkHeaderPaginationStrategy implements PaginationStrategyInterface { public function buildRequest(DataQuery $query): array { /* return query + headers */ } public function parseResponse(ResponseInterface $response): DataPage { /* parse Link header */ } }
Inject into HttpDataSource. No fork needed. See extensibility map.