{"id":26210010,"url":"https://github.com/calkeo/laravel-cloudflare-ddns","last_synced_at":"2025-04-15T13:49:06.934Z","repository":{"id":51933368,"uuid":"361263220","full_name":"calkeo/laravel-cloudflare-ddns","owner":"calkeo","description":"A Laravel package that facilitates dynamic DNS (DDNS) in Cloudflare.","archived":false,"fork":false,"pushed_at":"2021-05-08T23:34:29.000Z","size":31,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T20:45:55.346Z","etag":null,"topics":["cloudflare","dynamic-dns","dynamic-dns-updater","laravel","package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calkeo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null},"funding":{"github":"calkeo"}},"created_at":"2021-04-24T20:46:31.000Z","updated_at":"2024-03-27T20:01:16.000Z","dependencies_parsed_at":"2022-08-23T18:41:03.292Z","dependency_job_id":null,"html_url":"https://github.com/calkeo/laravel-cloudflare-ddns","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calkeo%2Flaravel-cloudflare-ddns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calkeo%2Flaravel-cloudflare-ddns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calkeo%2Flaravel-cloudflare-ddns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calkeo%2Flaravel-cloudflare-ddns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calkeo","download_url":"https://codeload.github.com/calkeo/laravel-cloudflare-ddns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248593738,"owners_count":21130312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","dynamic-dns","dynamic-dns-updater","laravel","package","php"],"created_at":"2025-03-12T07:18:47.488Z","updated_at":"2025-04-15T13:49:06.916Z","avatar_url":"https://github.com/calkeo.png","language":"PHP","funding_links":["https://github.com/sponsors/calkeo"],"categories":[],"sub_categories":[],"readme":"# Cloudflare Dynamic DNS with Laravel\n\n[![Latest Stable Version](https://poser.pugx.org/calkeo/laravel-cloudflare-ddns/v)](//packagist.org/packages/calkeo/laravel-cloudflare-ddns) [![Total Downloads](https://poser.pugx.org/calkeo/laravel-cloudflare-ddns/downloads)](//packagist.org/packages/calkeo/laravel-cloudflare-ddns) [![License](https://poser.pugx.org/calkeo/laravel-cloudflare-ddns/license)](//packagist.org/packages/calkeo/laravel-cloudflare-ddns)\n[![GitHub Code Style Action Status](https://github.styleci.io/repos/361263220/shield)](https://github.com/calkeo/laravel-cloudflare-ddns/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amaster)\n\n\nThis 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.\n\n## Use Cases\n\nThis package can be used for multiple purposes. For instance:\n\n- Running a server on your home network that you want to be accessible to the public.\n- Automatically updating your DNS records when you deploy or migrate a site to a new server.\n\n## Prerequisites\n- PHP 8\n- Laravel 8\n\n## Installation\n\nInstall the package via composer:\n\n```bash\ncomposer require calkeo/laravel-cloudflare-ddns\n```\n\nPublish the config file and migrations:\n\n```bash\nphp artisan vendor:publish --provider=\"Calkeo\\Ddns\\DdnsServiceProvider\" \n```\n\nRun the migrations:\n\n```bash\nphp artisan migrate\n```\n\n## Configuration\n\nThe configuration file can be found at `config/cloudflare_ddns`:\n\n```php\nreturn [\n\n    /**\n     * The Cloudflare API token for the account that has privileges to manage\n     * the domains that you add to this file.\n     */\n    'cloudflare_api_token' =\u003e env('CLOUDFLARE_API_TOKEN'),\n\n    /**\n     * The amount of time in seconds that the public IP address is cached for\n     * each time the ddns:sync command is executed.\n     */\n    'cache_duration' =\u003e env('DDNS_CACHE_DURATION', 60),\n\n    /**\n     * The domains to sync with this system's IP address.\n     */\n    'domains' =\u003e [\n        [\n            'domain' =\u003e '',\n            // The domain that the DNS records will be synced with.\n            'sync_interval' =\u003e 5,\n            // The interval in minutes for which this domain's records will be updated\n            'records' =\u003e [\n                [\n                    'name' =\u003e '', // DNS record name\n                    'type' =\u003e '', // DNS record type\n                    'ttl' =\u003e 1,\n                    // Time to live for DNS record. Value of 1 is 'automatic'\n                    'proxied' =\u003e true,\n                    // Whether the DNS record is proxied through Cloudflare\n                ],\n            ],\n        ],\n    ],\n\n];\n```\n\n### `cloudflare_api_token`\n\n_(string)_\n\nA 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](https://developers.cloudflare.com/api/tokens/create).\n\n---\n\n### `cache_duration`\n\n_(integer)_\n\nThe amount of time in seconds that the public IP address is cached for each time the `ddns:sync` command is executed.\n\nThe 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.\n\n---\n\n### `domains[]`\n\n_(array)_\n\nThe domains to be synced. A domain is referred to as a _Zone_ within Cloudflare.\n\n---\n\n### `domains[][domain]`\n\n_(string)_\n\nThe 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.\n\n---\n\n### `domains[][sync_interval]`\n\n_(integer)_\n\nHow often (in minutes) the domain's DNS records will be synced with the server's public IP address.\n\n---\n\n### `domains[][records]`\n\n_(array)_\n\nThe DNS records to be synced for the domain.\n\nA 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.\n\n---\n\n### `domains[][records][name]`\n\n_(string)_\n\nThe DNS record name.\n\nFor instance:\n\n- Record name `www` for `www.domain.com`\n- Record name `mysubdomain` for `mysubdomain.domain.com` \n\n---\n\n### `domains[][records][type]`\n\n_(string)_\n\nThe DNS record type. Valid types are:\n\n- `A`\n- `AAAA`\n- `CNAME`\n- `HTTPS`\n- `TXT`\n- `SRV`\n- `LOC`\n- `MX`\n- `NS`\n- `SPF`\n- `CERT`\n- `DNSKEY`\n- `DS`\n- `NAPTR`\n- `SMIMEA`\n- `SSHFP`\n- `SVCB`\n- `TLSA`\n- `URI`\n\n---\n\n### `domains[][records][ttl]`\n\n_(integer)_\n\nThe DNS record TTL (time-to-live). Setting this value to `1` sets the DNS record TTL to 'automatic'.\n\n---\n\n### `domains[][records][proxied]`\n\n_(boolean)_\n\nWhether the DNS record should be proxied through Cloudflare's network.\n\nA brief explanation of Cloudflare DNS proxying ([source](https://community.cloudflare.com/t/what-is-the-difference-between-proxied-and-dns-only/173310)):\n\n\u003e 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.\n\u003e\n\u003e Non proxied means all traffic goes directly to your own IP without Cloudflare being a safety net in front.\n\u003e\n\u003e 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.\n\u003e\n\u003e Non proxied has the advantage of being able to use custom ports to connect as it will connect to your IP directly.\n\n__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](https://support.cloudflare.com/hc/en-us/articles/200169156-Identifying-network-ports-compatible-with-Cloudflare-s-proxy).\n\n---\n## Usage\n\nTo continually sync your configured domains, it is recommended to create a scheduled task that runs the `ddns:sync` command every minute.\n\n```php\n// App/Console/Kernel.php\n\nprotected function schedule(Schedule $schedule)\n{\n    $schedule-\u003ecommand('ddns:sync')-\u003eeveryMinute();\n}\n```\n\nThe 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.\n\nAn 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.\n\n## Roadmap\n| Feature | Status |\n| ------- | ------ |\n| Allow creation of new records | Upcoming |\n| Support custom IP resolvers | Upcoming |\n| Event Broadcasting | Upcoming |\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Callum Keogan](https://github.com/calkeo)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalkeo%2Flaravel-cloudflare-ddns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalkeo%2Flaravel-cloudflare-ddns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalkeo%2Flaravel-cloudflare-ddns/lists"}