1. Go to this page and download the library: Download tacman/gcf-php 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/ */
tacman / gcf-php example snippets
use Gcf\Generic\Encoder;
use Gcf\Generic\Decoder;
$gcf = Encoder::encode($data); // array|scalar|null -> GCF text
$data = Decoder::decode($gcf); // GCF text -> array|scalar|null
use Gcf\{Payload, Symbol, Edge};
use Gcf\Graph\Encoder;
use Gcf\Graph\Decoder;
$payload = new Payload(
tool: 'context_for_task',
tokenBudget: 5000,
tokensUsed: 1847,
symbols: [new Symbol(qualifiedName: 'pkg.Auth', kind: 'function', score: 0.9, provenance: 'lsp_resolved')],
);
$gcf = Encoder::encode($payload);
$payload = Decoder::decode($gcf);
use Gcf\Session;
$session = new Session();
$out1 = $session->encode($payload1); // full declarations
$out2 = $session->encode($payload2); // previously-sent symbols become bare @N refs
use Gcf\Graph\StreamEncoder;
use Gcf\Generic\StreamEncoder as GenericStreamEncoder;
$enc = new StreamEncoder($sink, tool: 'context_for_task'); // $sink: resource|callable(string):void
$enc->writeSymbol($symbol);
$enc->writeEdge($edge);
$enc->close();
use Gcf\PackRoot; // graph profile
use Gcf\Generic\Delta\GenericPackRoot; // generic profile
$hash = PackRoot::compute($symbols, $edges); // "sha256:..."
$hash = GenericPackRoot::compute($genericSet);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.