Package Data | |
---|---|
Maintainer Username: | laradns |
Maintainer Contact: | andrew@laradns.com (Andrew Lees) |
Package Create Date: | 2017-03-05 |
Package Last Update: | 2017-10-23 |
Home Page: | https://laradns.com |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:08:45 |
Package Statistics | |
---|---|
Total Downloads: | 62 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 0 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This is the client for users of LaraDNS that exposes a php artisan dns:sync
console command which updates the IP address of a particular Cloudflare DNS record with that of the originating request.
As simple as it should be:
composer require laradns/laravel-client
Add your unique ID obtained after adding your site via the LaraDNS interface:
// .env
LARADNS_ID=AJBUEo3UcmZ0JDPgSCGxwIRrj5TyAU
Add the LaraDNS service provider:
// config/app.php
'providers' => [
// Other service providers...
LaraDns\Providers\LaraDnsServiceProvider::class,
]
Schedule the command to execute as often, or as little, as you wish. As it's a console command, you can even include it in your deploy script to ensure your DNS is always up-to-date.
// App/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('dns:sync')->everyFiveMinutes();
}
You may wish to perform your own actions on an IP update. To facilitate this, the client fires an LaraDns\Events\SiteUpdated
event each time an IP address changes, with the address as the payload.
Register a listener:
// App/Providers/EventServiceProvider.php
protected $listen = [
\LaraDns\Events\SiteUpdated::class => [
\App\Listeners\SiteIpUpdated::class,
],
];
Handle the event:
// App/Listeners/SiteIpUpdated.php
<?php
namespace App\Listeners;
class SiteIpUpdated
{
public function __construct()
{
//
}
public function handle(\LaraDns\Events\SiteUpdated $event)
{
// $event->newIpAddress;
}
}
Please feel free to contact hello@laradns.com for any assistance and troubleshooting.