Download the PHP package dipeshchangawala/php-url-checker without Composer
On this page you can find all versions of the php package dipeshchangawala/php-url-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dipeshchangawala/php-url-checker
More information about dipeshchangawala/php-url-checker
Files in dipeshchangawala/php-url-checker
Package php-url-checker
Short Description A package to check the status code of a URL and detect redirections.
License MIT
Informations about the package php-url-checker
PHP URL Status Checker
PHP URL Status Checker is a lightweight and flexible PHP package designed to help developers easily verify the status of URLs, extract canonical URLs, validate URLs, and perform other useful URL-related operations.
Features
- Check the HTTP status code of a given URL.
- Validate if a URL is well-formed and accessible.
- Extract the canonical URL from a webpage.
- Detect redirections and retrieve the
Locationheader. - Handle connection errors and timeouts gracefully.
- Extendable with more URL utilities for developers.
Requirements
- PHP 7.4 or higher
- Guzzle HTTP Client
Installation
Install the package via Composer:
Usage
Initialize the Package
Check URL Status
Example Output
If the URL redirects, the location field will contain the redirect URL.
Validate a URL
Get the Canonical URL
Example Output
Detect Redirects
Example Output
Retrieve all HTTP headers from the given URL
Example Output
Check if a URL is reachable and returns a 2xx or 3xx HTTP status code
Example Output
Retrieve the entire chain of redirects for a given URL
Example Output
Check whether the given URL uses a secure https connection
Example Output
Get the page title for a given URL
Fetch the Content-Type of a URL (e.g., text/html, application/json)
Example Output
Validating the syntax of a URL using PHP’s filter_var
Check the response time of a given URL (in second).
Check for broken links on a given webpage by scanning all href attributes.
Check the status of multiple URLs in a single call
Methods Overview
| Method | Description |
|---|---|
checkStatus($url) |
Returns the status code and Location header if applicable |
isValidUrl($url) |
Validates if the given URL is well-formed and accessible |
getCanonicalUrl($url) |
Extracts the canonical URL from the webpage, if available |
getRedirectLocation($url) |
Retrieves the Location header for redirects |
getRedirectChain($url) |
Retrieves the full redirect chain for a given URL |
isSecureUrl($url) |
Check if a given URL is secure |
getResponseHeaders($url) |
Get the response headers for a given URL |
getPageTitle($url) |
Get the page title for a given URL |
isReachable($url, $timeout) |
Check if a given URL is reachable within a specified timeout period |
getContentType($url) |
Fetch the Content-Type of a URL |
checkMultipleUrls(array $urls) |
Check the status of multiple URLs in a single call |
validateUrlFormat($url) |
A lightweight function to validate the syntax of a URL using PHP’s filter_var |
checkResponseTime($url) |
Check the response time of a given URL |
detectBrokenLinks($url) |
Check for broken links on a given webpage by scanning all href attributes |
License
This package is open-source software licensed under the MIT license.
This README.md gives clear instructions to developers on how to use your package while showcasing its key features. Let me know if you'd like to include additional sections!