Skip to content

Commit e8f3128

Browse files
committed
Add license, security policy and basic ussage in readme.
1 parent 571c697 commit e8f3128

File tree

5 files changed

+65
-3
lines changed

5 files changed

+65
-3
lines changed

.art/domainvalidity.png

3.51 KB
Loading

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33

44
# Exclude unused files
55
# see: https://redd.it/2jzp6k
6+
/.art export-ignore
67
/.github export-ignore
78
/data export-ignore
89
/tests export-ignore
910
/.editorconfig export-ignore
1011
/.gitattributes export-ignore
1112
/.gitignore export-ignore
12-
/phpcs.xml.dist export-ignore
13+
/phpcs.xml.dist export-ignore
1314
/phpunit.xml export-ignore
1415
/phpstan.neon export-ignore
1516
/README.md export-ignore
1617

1718
# Configure diff output for .php files.
18-
*.php diff=php
19+
*.php diff=php

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2023 - 2024 Alejandro Morelos
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
<p align="center">
2+
<img src="./.art/domainvalidity.png" width="200">
3+
</p>
4+
15
# Doma(in)Validity PHP package.
26

3-
Light PHP package to validate domains.
7+
Light PHP package to validate domains.
8+
9+
[Doma(in)Validity](https://api.domainvalidity.dev/) was born because I found myself searching online about how to check if a domain was valid. I always ended up using regular expressions that were too complex to account for several scenarios (mainly the TLD having different formats), it was just a pain in the butt because I always had to go back to that code to fix the regex to account for an edge case that I didn't think about.
10+
11+
## Installation
12+
13+
You can install the package via composer:
14+
15+
```bash
16+
composer require domainvalidity/php-domain-validator
17+
```
18+
19+
## Usage
20+
21+
```php
22+
use DomainValidity\Factory;
23+
24+
$contents = file_get_contents('https://publicsuffix.org/list/public_suffix_list.dat');
25+
26+
$validator = Factory::make($contents);
27+
28+
$host = $validator->validate('www.domainvalidity.dev');
29+
```
30+
31+
> **Note:** You should cache the contents of the public suffix list and download them no more than once per day, as it is not updated more than a few times per week; more frequent downloading is pointless.

SECURITY.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Security Policy
2+
3+
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**
4+
5+
## Supported Versions
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| 2.x | :white_check_mark: |
10+
| 1.x | :white_check_mark: |
11+
12+
## Reporting a Vulnerability
13+
14+
If you discover a security vulnerability within this package, please send an email to Alejandro Morelos at info@domainvalidity.dev. All security vulnerabilities will be promptly addressed.

0 commit comments

Comments
 (0)