PHP code example of cboxdk / platform

1. Go to this page and download the library: Download cboxdk/platform 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/ */

    

cboxdk / platform example snippets


use Cbox\Platform\Capability\PlatformTarget;
use Cbox\Platform\Compile\ServiceCompiler;
use Cbox\Platform\Service\ServiceSpec;

$manifests = new ServiceCompiler(new PlatformTarget)->compile(new ServiceSpec(
    serviceId: 'svc-checkout',
    organizationId: 'acme',
    namespace: 'cx-feature-checkout',
    name: 'web',
    image: 'ghcr.io/acme/checkout:2.1.0',
    port: 8080,
    replicas: 2,
    domains: ['checkout.acme.example'],
    scaleToZero: true,
));

echo $manifests->toYaml();   // hand this to kubectl, a client-go bridge, anything

$plan = new HashPlanner()->plan($desired, $appliedHashes);

$plan->summary();     // ['create' => 2, 'update' => 1, 'delete' => 0, 'unchanged' => 4]
$plan->hasChanges();  // false means a deploy would do nothing at all