{"id":17161181,"url":"https://github.com/lemaur/php-url-checker","last_synced_at":"2025-04-13T14:11:38.345Z","repository":{"id":229352019,"uuid":"776519403","full_name":"leMaur/php-url-checker","owner":"leMaur","description":"PHP package to check the URL HTTP response status code and reason phrase.","archived":false,"fork":false,"pushed_at":"2025-02-03T19:28:16.000Z","size":51,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T05:47:03.885Z","etag":null,"topics":["checker","guzzle","guzzle-php-library","guzzlehttp","http","php","status-code","url"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leMaur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"lemaur"}},"created_at":"2024-03-23T18:24:30.000Z","updated_at":"2025-02-12T12:59:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f1fd407-8542-43fb-a8cb-a144263e6208","html_url":"https://github.com/leMaur/php-url-checker","commit_stats":null,"previous_names":["lemaur/php-url-checker"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leMaur%2Fphp-url-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leMaur%2Fphp-url-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leMaur%2Fphp-url-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leMaur%2Fphp-url-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leMaur","download_url":"https://codeload.github.com/leMaur/php-url-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724629,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checker","guzzle","guzzle-php-library","guzzlehttp","http","php","status-code","url"],"created_at":"2024-10-14T22:27:26.362Z","updated_at":"2025-04-13T14:11:38.325Z","avatar_url":"https://github.com/leMaur.png","language":"PHP","funding_links":["https://github.com/sponsors/lemaur","https://github.com/sponsors/leMaur","https://github.com/sponsors/leMaur?frequency=one-time\u0026sponsor=leMaur"],"categories":[],"sub_categories":[],"readme":"# Check the URL HTTP response status code and reason phrase.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/lemaur/php-url-checker.svg?style=flat-square)](https://packagist.org/packages/lemaur/php-url-checker)\n[![Total Downloads](https://img.shields.io/packagist/dt/lemaur/php-url-checker.svg?style=flat-square)](https://packagist.org/packages/lemaur/php-url-checker)\n[![License](https://img.shields.io/packagist/l/lemaur/php-url-checker.svg?style=flat-square\u0026color=yellow)](https://github.com/leMaur/php-url-checker/blob/main/LICENSE.md)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/lemaur/php-url-checker/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/leMaur/php-url-checker/actions/workflows/run-tests.yml)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/lemaur/php-url-checker/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/leMaur/php-url-checker/actions/workflows/fix-php-code-style-issues.yml)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/lemaur?style=flat-square\u0026color=ea4aaa)](https://github.com/sponsors/leMaur)\n[![Trees](https://img.shields.io/badge/dynamic/json?color=yellowgreen\u0026style=flat-square\u0026label=Trees\u0026query=%24.total\u0026url=https%3A%2F%2Fpublic.offset.earth%2Fusers%2Flemaur%2Ftrees)](https://ecologi.com/lemaur?r=6012e849de97da001ddfd6c9)\n\nThis package for PHP provide a class to check the URL HTTP response without downloading the HTTP content in response.\n\nThis reduces the bandwidth and the response time.\n\n## Support Me\n\nHey folks,\n\nDo you like this package? Do you find it useful and it fits well in your project?\n\nI am glad to help you, and I would be so grateful if you considered supporting my work.\n\nYou can even choose 😃:\n* You can [sponsor me 😎](https://github.com/sponsors/leMaur) with a monthly subscription.\n* You can [buy me a coffee ☕ or a pizza 🍕](https://github.com/sponsors/leMaur?frequency=one-time\u0026sponsor=leMaur) just for this package.\n* 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. \n* You can \"Star ⭐\" this repository (it's free 😉).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require lemaur/php-url-checker\n```\n\n## Usage\n\nThe class `Lemaur\\UrlChecker\\UrlChecker` provides a static method `check` where accepts the URL to check as first parameter\nand the user agent string as a second parameter.  \n\nHere you can see how to use it 👇\n\n```php\nuse Lemaur\\UrlChecker\\UrlChecker;\n\n$response = UrlChecker::check(\n    url: 'https://google.com', \n    userAgent: 'MyApp/1.0 (UrlChecker)',\n    connectTimeout: 5,\n    timeout: 10,\n);\n// \\Lemaur\\UrlChecker\\DataTransferObject\\CheckData\n\n$response-\u003estatusCode;\n// (int) 200\n\n$response-\u003ereasonPhrase;\n// (string) 'OK'\n\n$response-\u003eheaders:\n// (array) ['Date' =\u003e ['Sun, 24 Mar 2024 09:06:08 GMT']]\n```\n\nThat class also provides another method to help you write unit tests.\n\nIt mocks the response to prevents any external network call. It accepts an array of `GuzzleHttp\\Psr7\\Response`.\n```php\nUrlChecker::fake([\n    new \\GuzzleHttp\\Psr7\\Response(200),\n]);\n\n$response = UrlChecker::check('https://dummy-url.com');\n\n$response-\u003estatusCode;\n// (int) 200\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Security Vulnerability\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\nThis 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/). \n\n- [Maurizio](https://github.com/lemaur)\n- [Chris White](https://github.com/cwhite92)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemaur%2Fphp-url-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemaur%2Fphp-url-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemaur%2Fphp-url-checker/lists"}