PHPackages                             laradns/laravel-client - 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. laradns/laravel-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laradns/laravel-client
======================

The Laravel client package for LaraDNS - automating the DNS update process.

v0.1(9y ago)263MITPHP

Since Mar 19Pushed 8y agoCompare

[ Source](https://github.com/laradns/laravel-client)[ Packagist](https://packagist.org/packages/laradns/laravel-client)[ RSS](/packages/laradns-laravel-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

LaraDNS - Client
================

[](#laradns---client)

This is the client for users of [LaraDNS](https://laradns.com) 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.

Installation
------------

[](#installation)

As simple as it should be:

### Require it

[](#require-it)

```
composer require laradns/laravel-client

```

### Configure it

[](#configure-it)

Add your unique ID obtained after adding your site via the [LaraDNS](https://laradns.com) interface:

```
// .env

LARADNS_ID=AJBUEo3UcmZ0JDPgSCGxwIRrj5TyAU
```

Add the LaraDNS service provider:

```
// config/app.php

'providers' => [
    // Other service providers...
    LaraDns\Providers\LaraDnsServiceProvider::class,
]
```

### Run it

[](#run-it)

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();
}
```

Events
------

[](#events)

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
