PHPackages                             africc/valid-hostname - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. africc/valid-hostname

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

africc/valid-hostname
=====================

A simple (but real) hostname validator

0.2.0(5y ago)2198↓100%1[2 PRs](https://github.com/AfriCC/php-valid-hostname/pulls)MITPHPPHP &gt;=7.3.0

Since Nov 11Pushed 2y agoCompare

[ Source](https://github.com/AfriCC/php-valid-hostname)[ Packagist](https://packagist.org/packages/africc/valid-hostname)[ Docs](https://github.com/AfriCC/php-valid-hostname)[ RSS](/packages/africc-valid-hostname/feed)WikiDiscussions main Synced 2mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

africc/valid-hostname
=====================

[](#africcvalid-hostname)

[![Build Status](https://camo.githubusercontent.com/1be659f9e652a3085e47d5f9161c8f5fee9b89aa86d615860e9d694d70a8e7df/68747470733a2f2f7472617669732d63692e636f6d2f4166726943432f7068702d76616c69642d686f73746e616d652e7376673f6272616e63683d6d61696e)](https://travis-ci.com/AfriCC/php-valid-hostname)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e078294fde70b48289ed4614f401444b12cbd39ce3d59f9432a9f4db6266aeea/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4166726943432f7068702d76616c69642d686f73746e616d652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/AfriCC/php-valid-hostname/?branch=main)[![Coverage Status](https://camo.githubusercontent.com/0b19b6a79670cbb6d7cdc300161a48a7a95166b9b4b0cf33941d66addf69be45/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4166726943432f7068702d76616c69642d686f73746e616d652f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/AfriCC/php-valid-hostname?branch=main)[![Latest Stable Version](https://camo.githubusercontent.com/870cf0f01bd53311ff767895be5867a2e53d61ddaca3c0b2f760cb561632df4f/68747470733a2f2f706f7365722e707567782e6f72672f6166726963632f76616c69642d686f73746e616d652f762f737461626c652e737667)](https://packagist.org/packages/africc/valid-hostname)[![Packagist](https://camo.githubusercontent.com/0f84ae4b241a07bfd46fe845660b1a9767ad6fb28cd51a9046fcde56476116aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6166726963632f76616c69642d686f73746e616d652e737667)](https://packagist.org/packages/africc/valid-hostname)[![Latest Unstable Version](https://camo.githubusercontent.com/425474b271ee8be7e13784044daefac24f9a0bddb8ce1e4944eb0153d486dbf7/68747470733a2f2f706f7365722e707567782e6f72672f6166726963632f76616c69642d686f73746e616d652f762f756e737461626c652e737667)](https://packagist.org/packages/africc/valid-hostname)[![License](https://camo.githubusercontent.com/d057922243bb8e17dcb9a751bc00604af1e7915ffa647866afdbba19d50c9e05/68747470733a2f2f706f7365722e707567782e6f72672f6166726963632f76616c69642d686f73746e616d652f6c6963656e73652e737667)](https://packagist.org/packages/africc/valid-hostname)

A simple (but real) hostname validator in PHP.

Install
-------

[](#install)

```
$ composer require africc/valid-hostname
```

Usage
-----

[](#usage)

```
