zero-to-prod / validate-url-cli
A CLI for Validating a Url.
Fund package maintenance!
Github
Requires
- php: >=8.1
- ext-json: *
- symfony/console: ^7.2
- zero-to-prod/data-model: ^81.9
- zero-to-prod/package-helper: ^1.1.3
- zero-to-prod/validate-url: ^71.0
Requires (Dev)
- phpunit/phpunit: <12.0
README
Contents
- Introduction
- Requirements
- Installation
- Documentation Publishing
- Usage
- Docker Image
- Local Development
- Image Development
- Contributing
Introduction
A CLI for Validating a Url.
Requirements
- PHP 8.1 or higher.
Installation
Install Zerotoprod\ValidateUrlCli
via Composer:
composer require zero-to-prod/validate-url-cli
This will add the package to your project's dependencies and create an autoloader entry for it.
Documentation Publishing
You can publish this README to your local documentation directory.
This can be useful for providing documentation for AI agents.
This can be done using the included script:
# Publish to default location (./docs/zero-to-prod/validate-url) vendor/bin/zero-to-prod-validate-url # Publish to custom directory vendor/bin/zero-to-prod-validate-url /path/to/your/docs
Automatic Documentation Publishing
You can automatically publish documentation by adding the following to your composer.json
:
{ "scripts": { "post-install-cmd": [ "zero-to-prod-validate-url" ], "post-update-cmd": [ "zero-to-prod-validate-url" ] } }
Usage
Run this command to see the available commands:
vendor/bin/validate-url-cli list
Available Commands
validate-url-cli:src
Display the project's GitHub repository URL.
Usage:
vendor/bin/validate-url-cli validate-url-cli:src
Arguments: None
Example:
vendor/bin/validate-url-cli validate-url-cli:src
Output:
https://github.com/zero-to-prod/validate-url-cli
validate-url-cli:validate
Validates a URL and returns the URL if valid, empty output otherwise.
Usage:
vendor/bin/validate-url-cli validate-url-cli:validate <url>
Arguments:
url
(required): The URL to validate
Example:
vendor/bin/validate-url-cli validate-url-cli:validate "https://example.com"
Output (valid URL):
https://example.com
Example with invalid URL:
vendor/bin/validate-url-cli validate-url-cli:validate "not-a-url"
Output (invalid URL):
validate-url-cli:show-regex
Display the regular expression pattern used to validate URLs.
Usage:
vendor/bin/validate-url-cli validate-url-cli:show-regex
Arguments: None
Example:
vendor/bin/validate-url-cli validate-url-cli:show-regex
Output:
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
Docker Image
You can also run the cli using the docker image:
docker run --rm davidsmith3/validate-url-cli
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.