1. Go to this page and download the library: Download appwrite-labs/php-k8s 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/ */
appwrite-labs / php-k8s example snippets
use RenokiCo\PhpK8s\K8s;
use RenokiCo\PhpK8s\KubernetesCluster;
$cluster = new KubernetesCluster('http://127.0.0.1:8080');
$pod = K8s::pod($cluster)
->setName('my-pod')
->setContainers([
K8s::container()->setName('app')->setImage('nginx:latest')
])
->create();
echo $pod->getName(); // my-pod
echo $pod->getPodPhase(); // Returns PodPhase enum
// No AWS CLI bernetesCluster::fromUrl($eksClusterUrl)
->withEksAuth('cluster-name', 'us-east-2')
->withCaCertificate('/path/to/ca.crt');
// Direct username/password authentication
$cluster = KubernetesCluster::fromUrl($openshiftUrl)
->withOpenShiftAuth('username', 'password');
// Automatically supported from kubeconfig
$cluster = KubernetesCluster::fromKubeConfigYamlFile('~/.kube/config');
// Works with AWS EKS, GKE, AKS, and custom credential providers
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.