1. Go to this page and download the library: Download hampel/linode-api-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Hampel\Linode\Api\Laravel\Facades\Linode;
use Hampel\Linode\Api\Entity\DomainRecord;
Linode::verify(); // does this token work?
$zone = Linode::domains()->findByName('example.com'); // null when there is no such zone
Linode::domains()->records($zone)->create(
DomainRecord::a('www', '203.0.113.10')->withTtl(300)
);
use Hampel\Linode\Api\Laravel\LinodeManager;
public function __construct(private readonly LinodeManager $linode) {}
$this->linode->client('staging')->domains()->all();
use Hampel\Linode\Api\Authentication\AccessToken;
$linode = Linode::withCredential(new AccessToken($tenant->linode_token));
use Hampel\Linode\Api\Exception\NotFoundException;
use Hampel\Linode\Api\Exception\NotAuthenticatedException;
use Hampel\Linode\Api\Exception\NotPermittedException;
try {
$zone = Linode::domains()->get($id);
} catch (NotFoundException $e) {
// no such zone on this account
} catch (NotPermittedException $e) {
// the token is real and lacks the scope, or the user lacks the grant
} catch (NotAuthenticatedException $e) {
// the credential is no good. A configuration error, not an empty result.
}