A lightweight and developer-friendly Laravel package for verifying domain ownership using DNS TXT records.
- 🔐 Verifies domain ownership via DNS TXT records.
- ⚙️ Easily configurable and customizable.
- 🔗 Prefix-based hashing for safe and unique TXT records.
- ⚡ Simple to integrate into any Laravel project.
composer require sysborg/check-my-domain
Optionally publish the configuration file:
php artisan vendor:publish --tag=check-my-domain-config
This will publish the file to:
config/checkMyDomain.php
return [
'prefix' => 'sbv',
'settings' => [
'use-domain' => true,
],
];
Key | Description |
---|---|
prefix |
Prefix used in the TXT record name/value (e.g., sbv=... ) |
use-domain |
If true , includes the domain name in the generated hash |
use Facades\Sysborg\CheckMyDomain\Lib\Domain;
$domainService = Domain::methodName(...parameters);
$record = Domain::generateTxtRecord('example.com', 'user-123');
// Output: sbv=4f8a3bd9eabf3c22bb9a5e2dd5c03f4c8ae6d2ef9f709137b20a2fd4e9d1
$isVerified = Domain::compareTxtRecord('example.com', $record);
if ($isVerified) {
echo '✅ Domain verified successfully!';
} else {
echo '❌ Domain verification failed.';
}
composer test
Or use PHPUnit directly if configured:
./vendor/bin/phpunit
src/
├── config/
│ └── checkMyDomain.php
├── Exceptions/
│ ├── InvalidDomainException.php
│ └── InvalidPrefixException.php
├── Lib/
│ └── Domain.php
├── Providers/
│ └── CheckMyDomainProvider.php
- The package generates a unique hash based on your prefix, user ID, domain, and timestamp.
- The user adds the TXT record to their DNS zone (e.g.
sbv=abcdef123456...
). - You use
compareTxtRecord()
to query the domain and validate if the correct TXT record is present.
This makes it easy to verify domain ownership for:
- User-generated domains
- SaaS onboarding
- API clients or webhook callbacks
- 🔗 Connect to onboarding flows (verify user domains).
- 🛡️ Add protection to webhook registration or integrations.
- ⚙️ Automate DNS verification with APIs like Cloudflare.
Maintained by Sysborg Created by Anderson Arruda
MIT License. See LICENSE file for details.