{"id":18929515,"url":"https://github.com/thecodingmachine/gitlab-registry-api","last_synced_at":"2025-07-16T09:36:51.769Z","repository":{"id":57067868,"uuid":"147644756","full_name":"thecodingmachine/gitlab-registry-api","owner":"thecodingmachine","description":"Library to use the Gitlab registry api in php","archived":false,"fork":false,"pushed_at":"2019-04-08T09:43:56.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-10T11:11:25.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-06T08:48:35.000Z","updated_at":"2019-08-12T21:21:44.000Z","dependencies_parsed_at":"2022-08-24T14:54:08.263Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/gitlab-registry-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thecodingmachine/gitlab-registry-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgitlab-registry-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgitlab-registry-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgitlab-registry-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgitlab-registry-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/gitlab-registry-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fgitlab-registry-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265500357,"owners_count":23777467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:33:21.052Z","updated_at":"2025-07-16T09:36:51.740Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/gitlab-registry-api/v/stable.svg)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)\n[![Total Downloads](https://poser.pugx.org/thecodingmachine/gitlab-registry-api/downloads.svg)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)\n[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/gitlab-registry-api/v/unstable.svg)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)\n[![License](https://poser.pugx.org/thecodingmachine/gitlab-registry-api/license.svg)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)\n[![Build Status](https://travis-ci.org/thecodingmachine/gitlab-registry-api.svg?branch=master)](https://travis-ci.org/thecodingmachine/gitlab-registry-api)\n\n\nGitlab registry api\n===================\nThis is a package to use Docker registry from GitLab. I wrote it because I couldn't found an usefull library with fully\nimplementation (read and destroy). To simplify the use, all element returned are objects (and it's pretty cool in your IDE).\n\nPrivate registry\n----------------\nIf you have a private registry, you'll need to create a Personal Access Token in order to access it.\nThis is in your profile, settings and access tokens. If you want to read and delete element, you must check \"api\" and \"read_registry\".\n\nInstallation\n------------\nUse Composer to install it, this repo is on Packagist, so something like this should be fine:\n```json\n{\n    \"require\": {\n        \"thecodingmachine/gitlab-registry-api\": \"^1.0\"\n    }\n}\n```\n\nThen do composer install or composer update in the usual way.\n\nTo make use of it, load the autoloader:\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\n```\n\nHow to it work\n--------------\nWith your personnal registry information (domain, token, gorup and project), I use Guzzle 6 to call the registry api.\nSo in all this package you could catch a Guzzle Exception if there is an error with an api call.\n\nHow to use it\n-------------\nI tried to simplify the use as much as possible with object manipulation. But is always possible to get the original array result,\nwith the function getPayload() on Image or Tag.\n\n### Get data\nThere is a getter for each attribut of each element.\n\nExample:\n```php\n// Create client with access\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n// Declare your registry and retrieve a Registry object\n$registry = $client-\u003egetRegistry('myGroup', 'myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    echo $image-\u003egetId();\n    foreach ($image-\u003egetTags() as $tag) {\n        echo $tag-\u003egeTotalSize();\n    }\n}\n```\n\nIf your group and project is already concatenated (like your registry comes from GitLab api), you could set it in only the group parameter :\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    echo $image-\u003egetId();\n    foreach ($image-\u003egetTags() as $tag) {\n        echo $tag-\u003egeTotalSize();\n    }\n}\n```\n\n#### Pagination\nIn the tag list, it's possible to add paginate parameter to filter result:\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    echo $image-\u003egetId();\n    // Pagination, get second page with 10 elements\n    foreach ($image-\u003egetTags(2, 10) as $tag) {\n        echo $tag-\u003egeTotalSize();\n    }\n}\n```\n\n### Destroy\nYou could destroy an image or only a tag with a simple method destroy.\n\nExample for image:\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    // This return true, false or guzzle exception\n    var_dump($image-\u003edestroy());\n}\n```\n\nExample for tag:\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    foreach ($image-\u003egetTags() as $tag) {\n        // This return true, false or guzzle exception\n        var_dump($tag-\u003edestroy());\n    }\n}\n```\n\n### Payload\nYou could retrieve the original array result.\n\nExample for image:\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    // This return original array\n    var_dump($image-\u003egetPayload());\n}\n```\n\nExample for tag:\n```php\n$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');\n$registry = $client-\u003egetRegistry('myGroup/myProject');\nforeach ($registry-\u003egetImages() as $image) {\n    foreach ($image-\u003egetTags() as $tag) {\n        // This return original array\n        var_dump($tag-\u003egetPayload());\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fgitlab-registry-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fgitlab-registry-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fgitlab-registry-api/lists"}