PHP code example of develate / antigravity-cli-php
1. Go to this page and download the library: Download develate/antigravity-cli-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/ */
develate / antigravity-cli-php example snippets
use Develate\AntigravityCli\Antigravity;
$agy = new Antigravity();
echo $agy->query('Summarise this repository.')->text;
use Develate\AntigravityCli\Antigravity;
use Develate\AntigravityCli\RunOptions;
use Develate\AntigravityCli\SessionOptions;
use Develate\AntigravityCli\Event\StepUpdateEvent;
use Develate\AntigravityCli\Value\Effort;
$agy = (new Antigravity('agy'))->in('/srv/project');
$options = new SessionOptions(
model: 'gemini-3.1-pro',
effort: Effort::High,
);
$run = $agy->session($options)->stream('Explain the build pipeline.', new RunOptions(timeout: 300.0));
foreach ($run as $event) {
if ($event instanceof StepUpdateEvent && $event->textDelta !== null) {
echo $event->textDelta;
}
}
$result = $run->result();
$run->cancel();
$session = $agy->session($options);
$session->query('Add a health check endpoint.');
$conversationId = $session->id();
$resumed = $agy->resume($conversationId, $options);
$resumed->query('Now add a test for it.');
$result->usage?->inputTokens; // this turn
$result->cumulativeUsage?->inputTokens; // the conversation so far
use Develate\AntigravityCli\Value\ExecutionMode;
// Edits are accepted; commands needing approval are denied, not prompted.
new SessionOptions(mode: ExecutionMode::AcceptEdits, sandbox: true);
// Everything is auto-approved.
new SessionOptions(dangerouslyBypassPermissions: true);
if ($result->hasDenials()) {
foreach ($result->deniedActions as $denied) {
echo $denied->displayName;
}
}
use Develate\AntigravityCli\Value\Capability;
$agy->supports(Capability::ResumeByConversationId); // true
$agy->supports(Capability::ImageInput); // false
$agy->capabilities()->
use Develate\AntigravityCli\Value\ModelCapabilities;
$showReasoningDropdown = ModelCapabilities::supportsReasoningEffort($selectedModel);
// false for 'claude-opus-4-6-thinking' or 'gemini-3.8-flash-high'
// true for 'gemini-3.8-flash', unknown/custom slugs, null and ''
$quota = $agy->quota();
if ($quota->available) {
foreach ($quota->entries as $entry) {
echo "{$entry->group}: {$entry->remainingPercent}% until {$entry->resetsAt?->format('c')}\n";
}
}
$agy->models();
$agy->agents();
$agy->mcp()->list();
$agy->plugins()->list();
$agy->remoteControl()->status();
$agy->changelog();
$agy->update(); // updates the binary in place
$agy->install(); // writes to the shell profile
$agy->isAvailable(); // the binary exists and is executable
$agy->isCompatible(); // it answers a command this SDK relies on
$agy->version(); // null when it cannot be read