PHPackages                             lemaur/php-url-checker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. lemaur/php-url-checker

ActiveLibrary[HTTP &amp; Networking](/categories/http)

lemaur/php-url-checker
======================

Check the url response status code and reason phrase.

1.1.2(4mo ago)31.5kMITPHPPHP ^8.1CI passing

Since Mar 23Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/leMaur/php-url-checker)[ Packagist](https://packagist.org/packages/lemaur/php-url-checker)[ Docs](https://github.com/lemaur/php-url-checker)[ GitHub Sponsors](https://github.com/lemaur)[ RSS](/packages/lemaur-php-url-checker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (6)Used By (0)

Check the URL HTTP response status code and reason phrase.
==========================================================

[](#check-the-url-http-response-status-code-and-reason-phrase)

[![Latest Version on Packagist](https://camo.githubusercontent.com/219b735e2a2df6b936258788e5c6fb460677bd849a33befd8b8380285c554222/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c656d6175722f7068702d75726c2d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lemaur/php-url-checker)[![Total Downloads](https://camo.githubusercontent.com/453555565225db42a93070501bdf7a0f2af060f45323a5e02f55718c54d473ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c656d6175722f7068702d75726c2d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lemaur/php-url-checker)[![License](https://camo.githubusercontent.com/d4bbaff4bc7560d805484df2f2ccfc366c47b2909512063f15d1815ab594e1c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c656d6175722f7068702d75726c2d636865636b65722e7376673f7374796c653d666c61742d73717561726526636f6c6f723d79656c6c6f77)](https://github.com/leMaur/php-url-checker/blob/main/LICENSE.md)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e1c4581ad9ba4334d3e8ee4f50ee5c327bca0b54201f6319bfef3e769b3ce4e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c656d6175722f7068702d75726c2d636865636b65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/leMaur/php-url-checker/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/7ff8e2f3b684665b19c880c18eb866e04d114f2c9c8da2241402b155241a023c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c656d6175722f7068702d75726c2d636865636b65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/leMaur/php-url-checker/actions/workflows/fix-php-code-style-issues.yml)[![GitHub Sponsors](https://camo.githubusercontent.com/67130ea26c0cdbb7c18af5c1fd1c7995f000bc3da607abffed1e39d789f48b2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f6c656d6175723f7374796c653d666c61742d73717561726526636f6c6f723d656134616161)](https://github.com/sponsors/leMaur)[![Trees](https://camo.githubusercontent.com/f12f2059f308501188008a8639ea876a9d8f8f3ce4047ea60b328985fc08b312/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f636f6c6f723d79656c6c6f77677265656e267374796c653d666c61742d737175617265266c6162656c3d54726565732671756572793d2532342e746f74616c2675726c3d68747470732533412532462532467075626c69632e6f66667365742e656172746825324675736572732532466c656d6175722532467472656573)](https://ecologi.com/lemaur?r=6012e849de97da001ddfd6c9)

This package for PHP provide a class to check the URL HTTP response without downloading the HTTP content in response.

This reduces the bandwidth and the response time.

Support Me
----------

[](#support-me)

Hey folks,

Do you like this package? Do you find it useful and it fits well in your project?

I am glad to help you, and I would be so grateful if you considered supporting my work.

You can even choose 😃:

- You can [sponsor me 😎](https://github.com/sponsors/leMaur) with a monthly subscription.
- You can [buy me a coffee ☕ or a pizza 🍕](https://github.com/sponsors/leMaur?frequency=one-time&sponsor=leMaur) just for this package.
- You can [plant trees 🌴](https://ecologi.com/lemaur?r=6012e849de97da001ddfd6c9). By using this link we will both receive 30 trees for free and the planet (and me) will thank you.
- You can "Star ⭐" this repository (it's free 😉).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lemaur/php-url-checker
```

Usage
-----

[](#usage)

The class `Lemaur\UrlChecker\UrlChecker` provides a static method `check` where accepts the URL to check as first parameter and the user agent string as a second parameter.

Here you can see how to use it 👇

```
use Lemaur\UrlChecker\UrlChecker;

$response = UrlChecker::check(
    url: 'https://google.com',
    userAgent: 'MyApp/1.0 (UrlChecker)',
    connectTimeout: 5,
    timeout: 10,
);
// \Lemaur\UrlChecker\DataTransferObject\CheckData

$response->statusCode;
// (int) 200

$response->reasonPhrase;
// (string) 'OK'

$response->headers:
// (array) ['Date' => ['Sun, 24 Mar 2024 09:06:08 GMT']]
```

That class also provides another method to help you write unit tests.

It mocks the response to prevents any external network call. It accepts an array of `GuzzleHttp\Psr7\Response`.

```
UrlChecker::fake([
    new \GuzzleHttp\Psr7\Response(200),
]);

$response = UrlChecker::check('https://dummy-url.com');

$response->statusCode;
// (int) 200
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Security Vulnerability
----------------------

[](#security-vulnerability)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

This package has been inspired by [Chris White](https://github.com/cwhite92)'s [blog post](https://chriswhite.is/coding/inspecting-http-response-headers-without-downloading-body-with-guzzle/).

- [Maurizio](https://github.com/lemaur)
- [Chris White](https://github.com/cwhite92)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance82

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Total

4

Last Release

133d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2696e190d36ed3a6809d954e3ae2153f969be340ef9b188f8a02bdc98b52f6c7?d=identicon)[leMaur](/maintainers/leMaur)

---

Top Contributors

[![leMaur](https://avatars.githubusercontent.com/u/2118799?v=4)](https://github.com/leMaur "leMaur (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

checkerguzzleguzzle-php-libraryguzzlehttphttpphpstatus-codeurlurlstatus codecheckerurl checkerlemaurphp-url-checker

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lemaur-php-url-checker/health.svg)

```
[![Health](https://phpackages.com/badges/lemaur-php-url-checker/health.svg)](https://phpackages.com/packages/lemaur-php-url-checker)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.0B3.2k](/packages/guzzlehttp-psr7)[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k789.4M1.8k](/packages/symfony-routing)[league/uri

URI manipulation library

1.1k206.4M277](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

536204.9M23](/packages/league-uri-interfaces)[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48819.2M541](/packages/nette-http)[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8321.5M36](/packages/jbzoo-utils)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
