PHPackages                             codeq/assethelpers - 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. codeq/assethelpers

ActiveNeos-package

codeq/assethelpers
==================

A package to provide selection of whole asset collection and tags in Neos content editing that keeps caching in mind.

v1.0.0(11mo ago)071PHPCI passing

Since May 30Pushed 11mo agoCompare

[ Source](https://github.com/code-q-web-factory/CodeQ.AssetHelpers)[ Packagist](https://packagist.org/packages/codeq/assethelpers)[ RSS](/packages/codeq-assethelpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

CodeQ.AssetHelpers
==================

[](#codeqassethelpers)

A package to provide selection of whole asset collection and tags in Neos content editing that keeps caching in mind.

CodeQ.Asset EelHelper
---------------------

[](#codeqasset-eelhelper)

The `CodeQ.Asset` EelHelper provides utility methods for working with assets, asset collections, and tags in Neos CMS. It is designed to be used in Eel expressions and supports various operations such as retrieving assets by collection or tag, sorting assets, and converting file sizes to human-readable formats.

### Methods

[](#methods)

#### `CodeQ.Asset.getCollectionByIdentifier(string $identifier): ?AssetCollection`

[](#codeqassetgetcollectionbyidentifierstring-identifier-assetcollection)

Retrieves an `AssetCollection` by its identifier.

- **Parameters**:
    - `string $identifier`: The identifier of the asset collection.
- **Returns**: The `AssetCollection` object if found, or `null` if not.

---

#### `CodeQ.Asset.getTagByIdentifier(string $identifier): ?Tag`

[](#codeqassetgettagbyidentifierstring-identifier-tag)

Retrieves a `Tag` by its identifier.

- **Parameters**:
    - `string $identifier`: The identifier of the tag.
- **Returns**: The `Tag` object if found, or `null` if not.

---

#### `CodeQ.Asset.getAssetsByCollection(mixed $collection, ?string $type = null): array`

[](#codeqassetgetassetsbycollectionmixed-collection-string-type--null-array)

Retrieves assets from a given collection, optionally filtered by type.

- **Parameters**:
    - `mixed $collection`: The collection identifier or an `AssetCollection` object.
    - `string\|null $type`: The type of assets to retrieve (`'image'` for images, or `null` for all assets).
- **Returns**: An array of assets in the collection, sorted by title or filename.
- **Throws**:
    - `InvalidArgumentException` if an invalid type is provided.
    - `InvalidQueryException` if the query fails.

---

#### `CodeQ.Asset.getAssetsByTag(mixed $tag, ?string $type = null): array`

[](#codeqassetgetassetsbytagmixed-tag-string-type--null-array)

Retrieves assets associated with a given tag, optionally filtered by type.

- **Parameters**:
    - `mixed $tag`: The tag identifier or a `Tag` object.
    - `string\|null $type`: The type of assets to retrieve (`'image'` for images, or `null` for all assets).
- **Returns**: An array of assets associated with the tag, sorted by title or filename.
- **Throws**:
    - `InvalidArgumentException` if an invalid type is provided.
    - `InvalidQueryException` if the query fails.

---

#### `CodeQ.Asset.humanReadableFileSize(int $size): string`

[](#codeqassethumanreadablefilesizeint-size-string)

Converts a file size in bytes to a human-readable format.

- **Parameters**:
    - `int $size`: The file size in bytes.
- **Returns**: A string representing the file size in a human-readable format (e.g., `1.2 MB`, `512 KB`).

---

### Usage Example

[](#usage-example)

You can use the `CodeQ.Asset` EelHelper in your Fusion code as follows:

```
prototype(Your.Package:Component) {
    assets = ${CodeQ.Asset.getAssetsByCollection('your-collection-identifier')}
    humanReadableSize = ${CodeQ.Asset.humanReadableFileSize(1048576)} # Outputs "1.0 MB"
}

```

### Notes

[](#notes)

- The methods are designed to handle both identifiers and object instances for collections and tags.

CodeQ.AssetCacheTag EelHelper
-----------------------------

[](#codeqassetcachetag-eelhelper)

The `CodeQ.AssetCacheTag` EelHelper provides utility methods for generating cache tags for assets, asset collections, and tags in Neos CMS. These methods are designed to be used in Eel expressions and help manage caching effectively.

### Methods

[](#methods-1)

#### `CodeQ.AssetCacheTag.assetTag(array|Asset $assets): array`

[](#codeqassetcachetagassettagarrayasset-assets-arraystring)

Generates cache tags for a given asset or an array of assets.

- **Parameters**:
    - `array|Asset $assets`: A single `Asset` object or an array of `Asset` objects.
- **Returns**: An array of cache tags for the provided assets.

---

#### `CodeQ.AssetCacheTag.assetCollectionTag(AssetCollection $assetCollection): string`

[](#codeqassetcachetagassetcollectiontagassetcollection-assetcollection-string)

Generates a cache tag for a given asset collection.

- **Parameters**:
    - `AssetCollection $assetCollection`: The asset collection for which the cache tag is generated.
- **Returns**: A string representing the cache tag for the asset collection.

---

#### `CodeQ.AssetCacheTag.assetTagsCachingTag(array|Tag $tags): array`

[](#codeqassetcachetagassettagscachingtagarraytag-tags-arraystring)

Generates cache tags for a given tag or an array of tags.

- **Parameters**:
    - `array|Tag $tags`: A single `Tag` object or an array of `Tag` objects.
- **Returns**: An array of cache tags for the provided tags.

---

### Usage Example

[](#usage-example-1)

You can use the `CodeQ.AssetCacheTag` EelHelper in your Fusion code as follows:

```
prototype(Your.Package:Component) {
    @cache {
        entryTags {
            0 = ${CodeQ.AssetCacheTag.assetTag(asset)}
            1 = ${CodeQ.AssetCacheTag.assetCollectionTag(assetCollection)}
            2 = ${CodeQ.AssetCacheTag.assetTagsCachingTag(tags)}
        }
    }
}

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance51

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

344d ago

### Community

Maintainers

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

---

Top Contributors

[![gradinarufelix](https://avatars.githubusercontent.com/u/4405087?v=4)](https://github.com/gradinarufelix "gradinarufelix (6 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/codeq-assethelpers/health.svg)

```
[![Health](https://phpackages.com/badges/codeq-assethelpers/health.svg)](https://phpackages.com/packages/codeq-assethelpers)
```

###  Alternatives

[neos/neos-ui

Neos CMS UI written in React

2661.0M104](/packages/neos-neos-ui)[neos/form-builder

Flow Form Framework integration into Neos CMS

19347.1k18](/packages/neos-form-builder)[neos/demo

Site package for the Neos Demo Site

18181.0k6](/packages/neos-demo)[flowpack/media-ui

This module allows managing media assets including pictures, videos, audio and documents.

2184.5k2](/packages/flowpack-media-ui)[kaufmanndigital/gdpr-cookieconsent

A ready-to-run package, that integrates an advanced cookie consent banner into your Neos CMS site.

2540.7k](/packages/kaufmanndigital-gdpr-cookieconsent)[flowpack/neos-matomo

Track visits of your Neos site with the Matomo Open Analytics Platform!

2337.6k](/packages/flowpack-neos-matomo)

PHPackages © 2026

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