yakeing/get_header
yakeing/get_header is a lightweight Laravel/PHP package for retrieving HTTP headers from URLs. It provides a simple way to inspect response status, content type, redirects, and other header metadata in your applications.
composer require yakeing/get_header. Since the repository is archived, you may need to add it manually if Packagist no longer serves it, but the package is still available.vendor/yakeing/get_header/ and look for the primary class or function (likely yakeing\get_header\GetHeader or a global get_header() function). The README on GitHub shows a basic example, but it may be outdated.php artisan tinker:
$headers = get_header('https://example.com');
// or
$headers = (new \yakeing\get_header\GetHeader())->get('https://example.com');
Inspect the returned array to confirm it matches PHP’s native get_headers() structure (numeric and associative keys). Use this to verify status codes, Content-Type, redirect chains, etc.php artisan headers:check https://example.com) to validate real-world behavior before wiring it into controllers or jobs.App\Services\HeaderFetcher with a fetch(string $url): array method that delegates to the package. Bind it in a service provider and inject it where needed. This isolates the archived dependency and lets you swap it for Guzzle later without changing call sites.Content-Type. Log mismatches to Laravel’s log or a monitoring channel.200 and the correct Content-Type (e.g., image/* for avatar URLs). Guard against SSRF by restricting schemes/hosts and avoiding internal IPs.Header facade pointing to your wrapper service, so you can write Header::get($url) in controllers. This mimics Laravel’s Http facade but returns the raw header array.Illuminate\Support\Facades\Http (Guzzle). Use this package only when you specifically need the exact get_headers()-style output (e.g., multiple Set-Cookie headers flattened into an array) or want a zero-dependency alternative.allow_url_fopen and the HTTP stream wrapper. Ensure this is enabled in production (php -i | grep allow_url_fopen). If disabled, use a cURL-based wrapper instead.stream_context_create if the API supports a context parameter. Otherwise, implement your own fetcher.verify_peer settings and patch if necessary.false, check network connectivity, DNS resolution, and PHP error logs. Use Log::debug('headers', $headers) or dd() in Tinker. For intermittent issues, add retry logic in your wrapper.Cache::remember), retries, user-agent headers, or header parsing. Since it’s MPL-2.0, you can copy and modify the source into your app if needed (keep license notices).get_headers() for simple cases. Before adding the dependency, test PHP’s built-in get_headers($url, true). It may suffice and avoids an unmaintained package. Use yakeing/get_header only if it offers a specific improvement (e.g., better redirect handling or associative formatting) that you’ve verified.How can I help you explore Laravel packages today?