Download the PHP package calkeo/laravel-cloudflare-ddns without Composer
On this page you can find all versions of the php package calkeo/laravel-cloudflare-ddns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download calkeo/laravel-cloudflare-ddns
More information about calkeo/laravel-cloudflare-ddns
Files in calkeo/laravel-cloudflare-ddns
Package laravel-cloudflare-ddns
Short Description This package facilitates dynamic DNS (DDNS) for Cloudflare with no third-party integrations. The package interacts directly with the Cloudflare API to sync the current system's IP address with your Cloudflare DNS records.
License MIT
Homepage https://github.com/calkeo/laravel-cloudflare-ddns
Informations about the package laravel-cloudflare-ddns
Cloudflare Dynamic DNS with Laravel
This package facilitates dynamic DNS (DDNS) for Cloudflare with no third-party integrations. The package interacts directly with the Cloudflare API to sync the current system's IP address with your Cloudflare DNS records.
Use Cases
This package can be used for multiple purposes. For instance:
- Running a server on your home network that you want to be accessible to the public.
- Automatically updating your DNS records when you deploy or migrate a site to a new server.
Prerequisites
- PHP 8
- Laravel 8
Installation
Install the package via composer:
Publish the config file and migrations:
Run the migrations:
Configuration
The configuration file can be found at config/cloudflare_ddns
:
cloudflare_api_token
(string)
A Cloudflare API token that has sufficient privileges to access the DNS records for the domains listed in the config file. How to generate a Cloudflare API token.
cache_duration
(integer)
The amount of time in seconds that the public IP address is cached for each time the ddns:sync
command is executed.
The IP address is automatically flushed from the cache each time the ddns:sync
command is executed. Because an external network request has to be made in order to retrieve the public IP address, increasing the cache duration will increase performance.
domains[]
(array)
The domains to be synced. A domain is referred to as a Zone within Cloudflare.
domains[][domain]
(string)
The base domain name, also referred to as the Zone. This must be the base of the domain as any subdomains will be configured within the records
array.
domains[][sync_interval]
(integer)
How often (in minutes) the domain's DNS records will be synced with the server's public IP address.
domains[][records]
(array)
The DNS records to be synced for the domain.
A record will be synced if there is already an existing DNS record in Cloudflare for this domain that matches the type
and name
specified for the record in the config file.
domains[][records][name]
(string)
The DNS record name.
For instance:
- Record name
www
forwww.domain.com
- Record name
mysubdomain
formysubdomain.domain.com
domains[][records][type]
(string)
The DNS record type. Valid types are:
A
AAAA
CNAME
HTTPS
TXT
SRV
LOC
MX
NS
SPF
CERT
DNSKEY
DS
NAPTR
SMIMEA
SSHFP
SVCB
TLSA
URI
domains[][records][ttl]
(integer)
The DNS record TTL (time-to-live). Setting this value to 1
sets the DNS record TTL to 'automatic'.
domains[][records][proxied]
(boolean)
Whether the DNS record should be proxied through Cloudflare's network.
A brief explanation of Cloudflare DNS proxying (source):
The DNS proxied means it will be shown a Cloudflare IP if you look it up. Thus all attacks at that domain will DDoS Cloudflare and not you host directly.
Non proxied means all traffic goes directly to your own IP without Cloudflare being a safety net in front.
The upside of proxied is that you will enjoy the Coudflare benefits but you can not make a direct connection to your IP, which means any custom ports wont work.
Non proxied has the advantage of being able to use custom ports to connect as it will connect to your IP directly.
If you are using this package to setup DDNS for your home network, you should take note from the above, that if you proxy your IP address through Cloudflare then you cannot use custom ports. Read about the ports available whilst proxying through Cloudflare.
Usage
To continually sync your configured domains, it is recommended to create a scheduled task that runs the ddns:sync
command every minute.
The package will only sync with a domain in Cloudflare if the domain has not yet been synced, or if it is due to run based on the sync_interval
value set for the domain in the config file.
An individual record will also not be updated if it is determined that there has been no change in IP address, and if the ttl
and proxied
values for the record in the config file are up-to-date in Cloudflare.
Roadmap
Feature | Status |
---|---|
Allow creation of new records | Upcoming |
Support custom IP resolvers | Upcoming |
Event Broadcasting | Upcoming |
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Callum Keogan
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-cloudflare-ddns with dependencies
illuminate/contracts Version ^8.0
spatie/laravel-package-tools Version ^1.4.3