PHPackages                             monosize/dynamic-dns-ip-updater - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. monosize/dynamic-dns-ip-updater

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

monosize/dynamic-dns-ip-updater
===============================

Updates .htaccess with current IP addresses from dynamic DNS domains

v1.1.1(2mo ago)0146MITPHPPHP &gt;=8.1

Since Feb 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/monosize/dynamic-dns-ip-updater)[ Packagist](https://packagist.org/packages/monosize/dynamic-dns-ip-updater)[ RSS](/packages/monosize-dynamic-dns-ip-updater/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (7)Used By (0)

Dynamic DNS IP Updater for Apache
=================================

[](#dynamic-dns-ip-updater-for-apache)

This Symfony bundle provides an automated solution for managing dynamic IP addresses in Apache's access control configurations. In environments where IP addresses change regularly, maintaining accurate access control becomes challenging. This bundle solves that problem by automatically synchronizing your Apache configuration with the current IP addresses of your dynamic DNS domains.

Understanding Dynamic DNS and Access Control
--------------------------------------------

[](#understanding-dynamic-dns-and-access-control)

Dynamic DNS (DDNS) is a method of automatically updating DNS records in real-time. It's commonly used when your IP address might change periodically, such as with residential internet connections or cloud services that don't provide static IPs. While DDNS ensures your domain always points to the correct IP, maintaining access control based on these IPs requires additional automation.

This bundle bridges that gap by monitoring your dynamic DNS domains and automatically updating your Apache configuration whenever IP changes are detected. It supports both IPv4 and IPv6, providing comprehensive coverage for modern network environments.

Core Features
-------------

[](#core-features)

The bundle has been designed with reliability and efficiency in mind:

Monitoring and Updates:

- Tracks multiple dynamic DNS domains simultaneously
- Supports both IPv4 and IPv6 address resolution
- Implements intelligent caching to minimize unnecessary DNS queries
- Provides automatic updates when IP changes are detected

Safety and Reliability:

- Creates automatic backups before any modifications
- Implements automatic rollback on failure
- Provides comprehensive logging for all operations
- Maintains atomic operations to prevent configuration corruption

Integration:

- Seamlessly integrates with Symfony's ecosystem
- Works with Apache's .htaccess configuration
- Supports both manual and automated operation
- Provides command-line interface for easy management

System Requirements
-------------------

[](#system-requirements)

Before installation, ensure your environment meets these prerequisites:

- PHP 8.1 or higher Required for modern language features and type safety
- Symfony 6.0 or 7.0 Provides the foundation for robust application architecture
- Apache web server with .htaccess support Necessary for implementing dynamic access control
- Write permissions for the .htaccess file Required for automated configuration updates
- DNS resolution capabilities Needed for resolving dynamic DNS entries

Installation and Setup
----------------------

[](#installation-and-setup)

1. First, install the package using Composer:

```
composer require monosize/dynamic-dns-ip-updater
```

2. Register the bundle in your Symfony application. Add this line to `config/bundles.php`:

```
return [
    // ... other bundles ...
    Monosize\DynamicDnsIpUpdater\DynamicDnsIpUpdaterBundle::class => ['all' => true],
];
```

3. Configure your dynamic DNS domains by creating or updating your `.env` file:

```
# List your domains, separated by commas
# Example: DNS_DOMAINS=office.dynamicdns.net,backup.dyndns.org
DNS_DOMAINS=yourdomain1.example.org,yourdomain2.example.org
```

Configuration Management
------------------------

[](#configuration-management)

The bundle manages a dedicated section in your .htaccess file, marked with clear delimiters:

```
# START DYNAMIC DNS BLOCK
# Dynamic DNS IPv4 addresses
Require ip 203.0.113.1
# Dynamic DNS IPv6 addresses
Require ip 2001:db8::1
# END DYNAMIC DNS BLOCK
```

This block is automatically maintained by the bundle. The clear delimiters ensure:

- Easy identification of managed sections
- Safe updates without affecting other configurations
- Clean integration with existing access controls

Operation Modes
---------------

[](#operation-modes)

The bundle can operate in two primary modes:

### Manual Operation

[](#manual-operation)

Use the command-line interface for direct control:

```
# Standard update - checks cache and updates only if needed
php bin/console dns:update-dynamic-ip

# Force update - bypasses cache and forces configuration refresh
php bin/console dns:update-dynamic-ip --force
```

### Automated Operation

[](#automated-operation)

For continuous monitoring, you can implement automatic updates using either Symfony's Scheduler or traditional cron jobs.

Using Symfony Scheduler (Recommended):

```
# config/packages/scheduler.yaml
scheduler:
    dns_update:
        type: cron
        schedule: '*/5 * * * *'  # Updates every 5 minutes
        command: 'dns:update-dynamic-ip'
```

Using Traditional Crontab:

```
# Updates every 5 minutes
*/5 * * * * /usr/bin/php /path/to/your/project/bin/console dns:update-dynamic-ip
```

Understanding the Update Process
--------------------------------

[](#understanding-the-update-process)

Each update cycle follows a carefully designed process to ensure reliability:

1. Domain Resolution:

    - Reads configured domains from environment
    - Resolves current IPv4 and IPv6 addresses
    - Validates resolution results
2. Change Detection:

    - Compares new IPs with cached values
    - Determines if updates are necessary
    - Optimizes performance by avoiding unnecessary writes
3. Safe Updates:

    - Creates timestamped backup of current configuration
    - Validates backup creation
    - Implements update using atomic operations
4. Error Handling:

    - Detects any problems during update
    - Automatically restores from backup if needed
    - Logs detailed error information
5. Cache Management:

    - Updates cache with new IP addresses
    - Sets appropriate cache expiration
    - Maintains cache consistency

Monitoring and Logging
----------------------

[](#monitoring-and-logging)

The bundle integrates with Symfony's logging system to provide comprehensive operational insights:

Configuration Changes:

- IP address updates
- Backup operations
- Configuration modifications

Error Conditions:

- DNS resolution failures
- File operation issues
- Permission problems

Performance Metrics:

- Cache hits and misses
- Update timing
- Resource usage

Logs are written to your Symfony application's log directory (`var/log/`), following the standard Symfony logging conventions.

Development and Testing
-----------------------

[](#development-and-testing)

The bundle includes a comprehensive test suite and development tools:

Running Tests:

```
# Complete test suite with all checks
composer check-all

# Individual components
composer test           # Unit tests
composer test-coverage  # Coverage analysis
composer cs-check      # Code style validation
composer cs-fix        # Automatic style fixes
composer phpstan       # Static analysis
```

Test Coverage Analysis: To generate detailed coverage reports, install either PCOV (recommended) or Xdebug:

```
# Using PCOV
pecl install pcov

# Or using Xdebug
pecl install xdebug
```

Contributing
------------

[](#contributing)

We welcome contributions that improve the bundle's functionality or documentation. To contribute:

1. Fork the repository
2. Create a feature branch
3. Implement your changes with tests
4. Submit a pull request

For significant changes, please open an issue first to discuss your proposed changes.

Support and Troubleshooting
---------------------------

[](#support-and-troubleshooting)

If you encounter issues or need assistance:

1. Check the logs in `var/log/` for detailed error messages
2. Verify your DNS domains are correctly configured
3. Ensure proper file permissions for .htaccess
4. Open an issue on the GitHub repository with:
    - Detailed description of the problem
    - Relevant log entries
    - Your configuration (without sensitive data)
    - Steps to reproduce the issue

License
-------

[](#license)

This project is licensed under the MIT License, promoting open collaboration and reuse. See the LICENSE file for complete terms.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance85

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~94 days

Total

6

Last Release

76d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c74c171e71b921b80d2b6d85d02f99d797fb4eb028b1a57b17309a5719c9663d?d=identicon)[monosize](/maintainers/monosize)

---

Top Contributors

[![monosize](https://avatars.githubusercontent.com/u/1583746?v=4)](https://github.com/monosize "monosize (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/monosize-dynamic-dns-ip-updater/health.svg)

```
[![Health](https://phpackages.com/badges/monosize-dynamic-dns-ip-updater/health.svg)](https://phpackages.com/packages/monosize-dynamic-dns-ip-updater)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
