tourze / tencent-cloud-dns-bundle
腾讯云DNS域名解析服务Symfony Bundle集成
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/tencent-cloud-dns-bundle
Requires
- doctrine/collections: ^2.3
- doctrine/common: ^3.5
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.0
- doctrine/persistence: ^4.1
- easycorp/easyadmin-bundle: ^4
- jeremykendall/php-domain-parser: ^6.3.1
- knplabs/knp-menu: ^3.7
- monolog/monolog: ^3.1
- psr/log: ^3|^2|^1
- symfony/config: ^7.3
- symfony/console: ^7.3
- symfony/dependency-injection: ^7.3
- symfony/doctrine-bridge: ^7.3
- symfony/form: ^7.3
- symfony/framework-bundle: ^7.4
- symfony/http-kernel: ^7.3
- symfony/property-access: ^7.3
- symfony/routing: ^7.3
- symfony/serializer: ^7.3
- symfony/yaml: ^7.3
- tencentcloud/common: ^3.0.1327
- tencentcloud/dnspod: ^3.0.1327
- tourze/bundle-dependency: 1.*
- tourze/doctrine-indexed-bundle: 1.0.*
- tourze/doctrine-timestamp-bundle: 1.1.*
- tourze/doctrine-track-bundle: 1.1.*
- tourze/doctrine-user-bundle: 1.0.*
- tourze/easy-admin-enum-field-bundle: 1.0.*
- tourze/easy-admin-menu-bundle: 1.0.*
- tourze/enum-extra: 1.0.*
- tourze/symfony-dependency-service-loader: 1.0.*
- tourze/symfony-routing-auto-loader-bundle: 1.0.*
Requires (Dev)
- doctrine/data-fixtures: ^2.0
- doctrine/doctrine-fixtures-bundle: ^4.0
- nesbot/carbon: ^2.72 || ^3
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- tourze/phpunit-base: 1.*
- tourze/phpunit-doctrine-entity: 1.*
- tourze/phpunit-enum: 1.*
- tourze/phpunit-symfony-kernel-test: 2.0.*
- tourze/phpunit-symfony-unit-test: 2.0.*
- tourze/phpunit-symfony-web-test: 2.0.*
This package is auto-updated.
Last update: 2025-12-20 18:33:00 UTC
README
A Symfony bundle that provides integration with Tencent Cloud DNS (DNSPod) service for managing domain records.
Features
- Manage Tencent Cloud DNS accounts
- Create and manage DNS domains
- Create, update, and delete DNS records
- Synchronize DNS records between Tencent Cloud and local database
- Support for various DNS record types (A, MX, TXT, CNAME, NS, URI)
- Command line tools for DNS management
Requirements
- PHP 8.1 or higher
- Symfony 7.3 or higher
- Doctrine ORM 3.0 or higher
- Tencent Cloud account with DNS service enabled
Installation
composer require tourze/tencent-cloud-dns-bundle
The bundle uses Symfony's auto-configuration, so it will be automatically enabled once installed.
Configuration
This bundle doesn't require any specific configuration in your Symfony application. It uses Doctrine entities to store configuration and data.
Usage
Setting up a Tencent Cloud Account
Before using the DNS features, you need to add a Tencent Cloud account:
use TencentCloudDnsBundle\Entity\Account; // Create a new account $account = new Account(); $account->setName('My Tencent Cloud Account'); $account->setSecretId('your-secret-id'); // From Tencent Cloud Console $account->setSecretKey('your-secret-key'); // From Tencent Cloud Console // Save the account $entityManager->persist($account); $entityManager->flush();
Managing Domains
use TencentCloudDnsBundle\Entity\DnsDomain; // Create a new domain $domain = new DnsDomain(); $domain->setName('example.com'); $domain->setAccount($account); // Link to your Tencent Cloud account // Save the domain $entityManager->persist($domain); $entityManager->flush();
Managing DNS Records
use TencentCloudDnsBundle\Entity\DnsRecord; use TencentCloudDnsBundle\Enum\DnsRecordType; // Create a new DNS record $record = new DnsRecord(); $record->setDomain($domain); // Link to your domain $record->setName('www'); // Subdomain $record->setType(DnsRecordType::A); $record->setValue('192.168.1.1'); // IP address for A record $record->setTtl(600); // Time to live in seconds // Save the record $entityManager->persist($record); $entityManager->flush(); // The record will be synchronized with Tencent Cloud DNS
Synchronizing Records from Tencent Cloud
You can use the provided command to synchronize DNS records from Tencent Cloud to your local database:
bin/console tencent-cloud-dns:sync-domain-record-to-local
How It Works
The bundle provides a set of Doctrine entities to store DNS configuration and records. It uses the Tencent Cloud SDK to communicate with the DNSPod API for creating, updating, and deleting DNS records.
The workflow is as follows:
- Create an Account entity with your Tencent Cloud credentials
- Create a DnsDomain entity linked to the account
- Create DnsRecord entities linked to the domain
- The bundle will automatically synchronize the records with Tencent Cloud DNS
Advanced Usage
Using the DNS Service
You can inject the DNS service to programmatically manage DNS records:
use TencentCloudDnsBundle\Service\DnsService; class MyDnsController { public function __construct(private DnsService $dnsService) { } public function updateRecord(): Response { // Use the service to interact with Tencent Cloud DNS $result = $this->dnsService->updateRecord($record); // Handle the result } }
Custom Domain Parser
The bundle includes a domain parser factory for handling domain validation:
use TencentCloudDnsBundle\Service\DomainParserFactory; $parser = $this->domainParserFactory->create(); $domain = $parser->parse('example.com');
Security
- API Keys: Store your Tencent Cloud API keys securely. Never commit them to version control.
- Validation: All entity properties include validation constraints to prevent invalid data.
- Access Control: Implement proper access control in your application to restrict DNS management operations.
Security Best Practices
- Use environment variables for API credentials
- Implement proper user authentication and authorization
- Validate all user inputs before processing
- Use HTTPS for all API communications
- Regularly rotate your API keys
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
License
The MIT License (MIT). Please see License File for more information.