PHPackages                             thecodingmachine/gitlab-registry-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. thecodingmachine/gitlab-registry-api

ActiveLibrary[API Development](/categories/api)

thecodingmachine/gitlab-registry-api
====================================

Library to use the Gitlab registry api in php.

2442PHP

Since Apr 8Pushed 7y ago6 watchersCompare

[ Source](https://github.com/thecodingmachine/gitlab-registry-api)[ Packagist](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)[ RSS](/packages/thecodingmachine-gitlab-registry-api/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/53cbd0cee456c610e95498d99a9b6aeb5a6abf5ea9f806235714a0c09a45664c/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f6769746c61622d72656769737472792d6170692f762f737461626c652e737667)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)[![Total Downloads](https://camo.githubusercontent.com/8956eee31f8c1882d29b5a13af98d3201432e834a11451096fd86a02dad8583e/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f6769746c61622d72656769737472792d6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)[![Latest Unstable Version](https://camo.githubusercontent.com/a97e755ede3f0dd0faa69bc22a16206b0a4033b635e313596a0d482db119dd5c/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f6769746c61622d72656769737472792d6170692f762f756e737461626c652e737667)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)[![License](https://camo.githubusercontent.com/d860c9eb9440a558afee9515b1f4cb3dda859f3e7f4ad2942c078f8da1ad8a3d/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f6769746c61622d72656769737472792d6170692f6c6963656e73652e737667)](https://packagist.org/packages/thecodingmachine/gitlab-registry-api)[![Build Status](https://camo.githubusercontent.com/f6adc026adc5ad6cb65d3070ea70b7d930ac8304cab81561f2ced2cef646973f/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f6769746c61622d72656769737472792d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/thecodingmachine/gitlab-registry-api)

Gitlab registry api
===================

[](#gitlab-registry-api)

This is a package to use Docker registry from GitLab. I wrote it because I couldn't found an usefull library with fully implementation (read and destroy). To simplify the use, all element returned are objects (and it's pretty cool in your IDE).

Private registry
----------------

[](#private-registry)

If you have a private registry, you'll need to create a Personal Access Token in order to access it. This is in your profile, settings and access tokens. If you want to read and delete element, you must check "api" and "read\_registry".

Installation
------------

[](#installation)

Use Composer to install it, this repo is on Packagist, so something like this should be fine:

```
{
    "require": {
        "thecodingmachine/gitlab-registry-api": "^1.0"
    }
}
```

Then do composer install or composer update in the usual way.

To make use of it, load the autoloader:

```
require_once __DIR__ . '/vendor/autoload.php';
```

How to it work
--------------

[](#how-to-it-work)

With your personnal registry information (domain, token, gorup and project), I use Guzzle 6 to call the registry api. So in all this package you could catch a Guzzle Exception if there is an error with an api call.

How to use it
-------------

[](#how-to-use-it)

I tried to simplify the use as much as possible with object manipulation. But is always possible to get the original array result, with the function getPayload() on Image or Tag.

### Get data

[](#get-data)

There is a getter for each attribut of each element.

Example:

```
// Create client with access
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
// Declare your registry and retrieve a Registry object
$registry = $client->getRegistry('myGroup', 'myProject');
foreach ($registry->getImages() as $image) {
    echo $image->getId();
    foreach ($image->getTags() as $tag) {
        echo $tag->geTotalSize();
    }
}
```

If your group and project is already concatenated (like your registry comes from GitLab api), you could set it in only the group parameter :

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    echo $image->getId();
    foreach ($image->getTags() as $tag) {
        echo $tag->geTotalSize();
    }
}
```

#### Pagination

[](#pagination)

In the tag list, it's possible to add paginate parameter to filter result:

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    echo $image->getId();
    // Pagination, get second page with 10 elements
    foreach ($image->getTags(2, 10) as $tag) {
        echo $tag->geTotalSize();
    }
}
```

### Destroy

[](#destroy)

You could destroy an image or only a tag with a simple method destroy.

Example for image:

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    // This return true, false or guzzle exception
    var_dump($image->destroy());
}
```

Example for tag:

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    foreach ($image->getTags() as $tag) {
        // This return true, false or guzzle exception
        var_dump($tag->destroy());
    }
}
```

### Payload

[](#payload)

You could retrieve the original array result.

Example for image:

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    // This return original array
    var_dump($image->getPayload());
}
```

Example for tag:

```
$client = new Client('https://git.yourdomain.com/', 'myPrivateAccessToken');
$registry = $client->getRegistry('myGroup/myProject');
foreach ($registry->getImages() as $image) {
    foreach ($image->getTags() as $tag) {
        // This return original array
        var_dump($tag->getPayload());
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

![](https://avatars.githubusercontent.com/u/1847918?v=4)[TheCodingMachine](/maintainers/thecodingmachine)[@thecodingmachine](https://github.com/thecodingmachine)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (2 commits)")

### Embed Badge

![Health badge](/badges/thecodingmachine-gitlab-registry-api/health.svg)

```
[![Health](https://phpackages.com/badges/thecodingmachine-gitlab-registry-api/health.svg)](https://phpackages.com/packages/thecodingmachine-gitlab-registry-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
