PHPackages                             netglue/prismic-asset-api-client - 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. netglue/prismic-asset-api-client

ActiveLibrary[API Development](/categories/api)

netglue/prismic-asset-api-client
================================

1.0.0(1y ago)0113[1 PRs](https://github.com/netglue/prismic-asset-api-client/pulls)MITPHPPHP ~8.3 || ~8.4CI passing

Since Feb 13Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/netglue/prismic-asset-api-client)[ Packagist](https://packagist.org/packages/netglue/prismic-asset-api-client)[ RSS](/packages/netglue-prismic-asset-api-client/feed)WikiDiscussions 1.1.x Synced today

READMEChangelog (1)Dependencies (17)Versions (5)Used By (0)

Prismic Asset API PHP Client
============================

[](#prismic-asset-api-php-client)

This is a client for Prismic.io's Asset API.

You can find documentation on the API at [prismic.io/docs/asset-api-technical-reference](https://prismic.io/docs/asset-api-technical-reference)

Install
-------

[](#install)

```
composer require netglue/prismic-asset-api-client
```

Usage
-----

[](#usage)

You'll need to construct the concrete client yourself with all of its required dependencies:

- A [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP Client such as [php-http/curl-client](https://github.com/php-http/curl-client)
- [PSR-7](https://www.php-fig.org/psr/psr-7/) implementations with [PSR-17](https://www.php-fig.org/psr/psr-17/) Stream Factory, Request Factory and Uri Factory such as [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros/)

Assuming you have a PSR-11 container set up, you might be able to do something like this in a factory:

```
use Prismic\Asset\AssetClient;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;

$client = new AssetClient(
    'some-write-token',
    'some-repo-name',
    $container->get(ClientInterface::class),
    $container->get(RequestFactoryInterface::class),
    $container->get(UriFactoryInterface::class),
    $container->get(StreamFactoryInterface::class),
);
```

Basic Functionality
-------------------

[](#basic-functionality)

### Fetch a list of the current asset tags

[](#fetch-a-list-of-the-current-asset-tags)

```
use Prismic\Asset\Client;

assert($client instanceof Client);
$tags = $client->getTags();
```

### Manually add an asset tag

[](#manually-add-an-asset-tag)

```
use Prismic\Asset\Client;

assert($client instanceof Client);
$tags = $client->createTag('Some Tag');
```

### List Assets

[](#list-assets)

This library assumes that you'll probably want to use it for doing a migration, so the `listAssets` method fetches *all* asset details in batches of 10 *(The max result set size)*. This is likely to take a long time on a large media library…

```
use Prismic\Asset\Client;
use Prismic\Asset\Model\Asset;

assert($client instanceof Client);

/** @var list $assets */
$assets = $client->listAssets();
```

### Upload Assets

[](#upload-assets)

The `uploadAsset` method requires the file content as a string, a name or title for the file and its mime type. There are a number of optional fields for other file metadata such as its default `alt` attribute, private notes, copyright info and applied tags.

```
use Prismic\Asset\Client;

assert($client instanceof Client);

$asset = $client->uploadAsset(
    $fileContentsAsString,
    $fileBaseName,
    $mimeType,
);
```

### Update Asset Meta Data

[](#update-asset-meta-data)

All values except the identifier are optional. Replacing any other value with `null` will omit the field from the patch entirely. To remove values, you must supply empty strings, or in the case of tags, an empty array.

It is not possible to "nullify" asset properties, even sending null in the JSON payload will yield an asset with an empty string for that value.

```
use Prismic\Asset\Client;use Prismic\Asset\Model\AssetPatch;

assert($client instanceof Client);

$updatedAsset = $client->patchAssetMetaData(new AssetPatch(
    'some-asset-identifier',
    'New private notes content',
    'New copyright info',
    'New alt attribute',
    'updated-filename.txt',
    ['tag 1', 'tag 2'],
));
```

### Tags are automatically created

[](#tags-are-automatically-created)

During asset upload, or patch, tags are created automatically so both methods accept a list of tag names i.e. `['tag 1', 'tag 2']` saving you from mucking about with tag lists and tag id's.

Contributing
------------

[](#contributing)

Please feel free to get involved with development. The project uses PHPUnit for tests, and [Psalm](https://psalm.dev) and [PHPStan](https://phpstan.org) for static analysis. CI should have your back if you want to submit a feature or fix ;)

License
-------

[](#license)

[MIT Licensed](LICENSE.md).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance65

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

505d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6c21b0de8cc9938916a186f5f2ed0bee90a4e23e0b29cf7b9c18bfe99067f9b?d=identicon)[netglue](/maintainers/netglue)

---

Top Contributors

[![gsteel](https://avatars.githubusercontent.com/u/2803720?v=4)](https://github.com/gsteel "gsteel (15 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/netglue-prismic-asset-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/netglue-prismic-asset-api-client/health.svg)](https://phpackages.com/packages/netglue-prismic-asset-api-client)
```

###  Alternatives

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)

PHPackages © 2026

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