1. Go to this page and download the library: Download cainy/laravel-dockhand 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/ */
use Cainy\Dockhand\Facades\Dockhand;
// Check if the registry is online
Dockhand::isOnline(); // bool
// Get the API version
Dockhand::getApiVersion(); // RegistryApiVersion enum
// List all repositories
$repos = Dockhand::getRepositories();
// With pagination
$page = Dockhand::getRepositories(limit: 10);
// $page is a PaginatedResult when limit is set
$page->items; // Collection<int, string>
$page->hasMore(); // bool
$page->nextUrl; // ?string — pass to next request
// List tags of a repository
$tags = Dockhand::getTagsOfRepository('library/nginx');
// With pagination
$page = Dockhand::getTagsOfRepository('library/nginx', limit: 20);
// Get a manifest (returns ImageManifest or ManifestList depending on content)
$manifest = Dockhand::getManifest('library/nginx', 'latest');
if ($manifest->isManifestList()) {
// ManifestList — multi-platform image
$entry = $manifest->findManifestListEntryByPlatform(
Platform::create('linux', 'amd64')
);
// Fetch the platform-specific manifest from an entry
$imageManifest = Dockhand::getManifestFromManifestListEntry($entry);
} else {
// ImageManifest — single-platform image
$imageManifest = $manifest;
}
// Access manifest properties
$imageManifest->digest;
$imageManifest->config; // ImageConfigDescriptor
$imageManifest->layers; // Collection<int, ImageLayerDescriptor>
$imageManifest->getSize();
// Head request (lightweight — returns digest, content length, media type)
$head = Dockhand::headManifest('library/nginx', 'latest');
$head->digest;
$head->contentLength;
$head->mediaType;
// Push a manifest
$result = Dockhand::putManifest('library/nginx', 'latest', $manifest);
$result->digest;
$result->location;
// Download a blob
$data = Dockhand::getBlob('library/nginx', 'sha256:abc123...');
// Get blob size without downloading
$size = Dockhand::getBlobSize('library/nginx', 'sha256:abc123...');
// Get parsed image config from a manifest's config descriptor
$config = Dockhand::getImageConfigFromDescriptor($imageManifest->config);
$config->platform; // Platform
$config->created; // Carbon
// Delete a manifest by digest
Dockhand::deleteManifest('library/nginx', 'sha256:abc123...');
// Delete a blob
Dockhand::deleteBlob('library/nginx', 'sha256:abc123...');
use Cainy\Dockhand\Facades\Dockhand;
// Use a specific connection
$repos = Dockhand::connection('staging')->getRepositories();
// Typed accessors (throws if the connection's driver doesn't match)
$zot = Dockhand::zot('staging'); // ZotDriver
$dist = Dockhand::distribution(); // DistributionDriver (default connection)
// Release a connection (useful in long-running workers)
Dockhand::disconnect('staging');
$zot = Dockhand::zot('staging');
// Discover available extensions
$extensions = $zot->discoverExtensions();
// Search repositories via GraphQL
$results = $zot->search('{ GlobalSearch(query: "nginx") { ... } }');
// Search CVEs for an image
$cves = $zot->searchCVE('library/nginx', 'latest');
// User preferences
$zot->starRepository('library/nginx');
$zot->unstarRepository('library/nginx');
$zot->bookmarkRepository('library/nginx');
$zot->unbookmarkRepository('library/nginx');
// Tag deletion (not supported by standard distribution registries)
$zot->deleteManifest('library/nginx', 'latest');