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

Link Header Rfc5988 Laravel Package

kelunik/link-header-rfc5988

Lightweight PHP library to parse and generate RFC 5988 HTTP Link headers. Convert Link header strings into structured relations/URIs and build compliant headers for responses. Useful for API pagination, HATEOAS links, and web discovery.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install via Composer: composer require kelunik/link-header-rfc5988
  • Use the LinkHeader class to parse Link headers (e.g., from HTTP responses or requests)
  • First use case: parse a Link header string to extract relations and URIs, especially for Web Linking patterns like rel="next", rel="describedby", or rel="lrdd"
  • Start with LinkHeader::parse($headerString) — returns an array of Link objects, each containing uri, rel, and optional attributes (title, type, etc.)

Implementation Patterns

  • In middleware: Parse incoming/outgoing Link headers (e.g., in API responses for HAL or ActivityPub) to normalize or augment links
  • In HTTP clients: Extract pagination links (rel="next", rel="prev") from responses to auto-traverse paginated APIs
  • In link discovery workflows: Use parse() to locate endpoints like rel="http://webfinger.net/rel/profile-page" for user discovery (e.g., WebFinger)
  • Combine with sprintf or Header::addLink() to generate compliant headers if needed (note: this package is parser-only; generation requires manual header construction or complementary libraries)

Gotchas and Tips

  • The package is ** parser-only** — no serialization/back-composition support; build headers manually if needed -空格 and unusual quoting in header values can cause silent failures — always test with malformed inputs
  • Attributes are returned as array, case-sensitive keys (e.g., rel, title, type) — ensure correct casing (e.g., rel not Rel)
  • Since last release was in 2017, verify PHP compatibility (tested up to PHP 7.2); for newer apps, check if psr/http-message + community alternatives (e.g., nyholm/psr7 helpers) better fit your stack
  • Debug tip: json_encode(LinkHeader::parse($header)) for quick inspection of link structures
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata