1. Go to this page and download the library: Download prezly/kubernetes-client 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/ */
prezly / kubernetes-client example snippets
use GuzzleHttp\Client as HttpClient;
use Prezly\KubernetesClient\KubernetesClient;
$http = new HttpClient([
'base_uri' => 'https://kubernetes.local/',
'verify' => false,
]);
$client = new KubernetesClient($http);
use Prezly\KubernetesClient\KubernetesClientFactory as Factory;
$client = Factory::connectTo('https://kubernetes.companyintranet.local')
->withAccessToken(getenv('KUBERNETES_ACCESS_TOKEN'))
->withCertificateAuthority('/app/kubernetes.ca')
->constructClient();
// Interact with Kubernetes API with $client
use Prezly\KubernetesClient\KubernetesClient;
use Psr\Log\LoggerInterface;
$logger = new MyCustomLogger();
assert($logger instanceof LoggerInterface);
$client = new KubernetesClient($http, $logger);
use Prezly\KubernetesClient\KubernetesClientFactory as Factory;
$client = Factory::connectTo('https://kubernetes.companyintranet.local')
->withLogger(new MyCustomLogger())
->constructClient();