PHPackages                             aedart/athenaeum-etags - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. aedart/athenaeum-etags

ActiveLibrary[HTTP &amp; Networking](/categories/http)

aedart/athenaeum-etags
======================

ETags utilities and Http Conditional Request evaluation for your Laravel Application

9.25.1(2mo ago)01.5k↓33.3%1BSD-3-ClausePHPPHP ^8.3

Since Nov 28Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/aedart/athenaeum-etags)[ Packagist](https://packagist.org/packages/aedart/athenaeum-etags)[ Docs](https://aedart.github.io/athenaeum/)[ RSS](/packages/aedart-athenaeum-etags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (101)Used By (1)

Athenaeum ETags
===============

[](#athenaeum-etags)

This package provides a "profile" based approach to generate [ETags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag), and an evaluator to deal with [Http Conditional Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests), for your Laravel application.

ETags Examples
--------------

[](#etags-examples)

### Generate

[](#generate)

```
use Aedart\ETags\Facades\Generator;

// Generate an ETag for strong comparison, of content
$etag = Generator::makeStrong($content);

echo (string) $etag; // "4720b076892bb2fb65e75af902273c73a2967e4a"
```

Or to generate ETags that are flagged as "weak" (*for weak comparison*)

```
$etag = Generator::makeWeak($content);

echo (string) $etag; // W/"0815"
```

### Parsing

[](#parsing)

To parse ETags from Http headers, you can use the `parse()` method. It returns a collection of `ETag` instances.

```
// E.g. If-None-Match: W/"0815", W/"0816", W/"0817"
$collection = Generator::parse($request->header('If-None-Match'));

foreach ($collection as $etag) {
    echo (string) $etag;
}
```

### Compare

[](#compare)

ETags can also be matched against each other, in accordance with [RFC9110](https://httpwg.org/specs/rfc9110.html#rfc.section.8.8.3.2).

#### Using Collection

[](#using-collection)

```
// Etags from Http Header
$collection = Generator::parse($request->header('If-Match')); // E.g. 'W/"0815"'

// Other Etag for your resource
$etag = Generator::makeWeak($content); // E.g. W/"0815"

// Compare etags against resource's etag
echo $collection->contains($etag, true); // false - strong comparison
echo $collection->contains($etag);       // true - weak comparison
```

#### Using Etag instance

[](#using-etag-instance)

You can also compare individual `ETag` instances, using the `matches()` method.

```
$etagA = Generator::parseSingle('W/"0815"');
$etagB = Generator::parseSingle('W/"0815"');

echo $etagA->matches($etagB, true); // false - strong comparison
echo $etagA->matches($etagB);       // true - weak comparison
```

Evaluate Http Preconditions Examples
------------------------------------

[](#evaluate-http-preconditions-examples)

The `Evaluator` component is able to process the incoming request against all the defined [RFC9110 preconditions](https://httpwg.org/specs/rfc9110.html#preconditions), in accordance with specified [evaluation precedence](https://httpwg.org/specs/rfc9110.html#precedence). Depending on the precondition requested, if it passes or fails, the request can either proceed or it will be aborted using customisable Http Exceptions. Your Laravel application should do the rest, whenever the request is aborted.

```
use Aedart\ETags\Preconditions\Evaluator;
use Aedart\ETags\Preconditions\Resources\GenericResource;

// Process If-Match, If-None-Match, If-Modified-Since... etc
// Depending on condition's pass/fail, the request can be aborted via
// an appropriate Http Exception, or proceed to your logic...
$resource = Evaluator::make($request)
    ->evaluate(new GenericResource(
        data: $model,
        etag: $model->getStrongEtag(),
        lastModifiedDate: $model->updated_at
    ));
```

To summarise, the following preconditions are supported:

- [If-Match](https://httpwg.org/specs/rfc9110.html#field.if-match)
- [If-None-Match](https://httpwg.org/specs/rfc9110.html#field.if-none-match)
- [If-Modified-Since](https://httpwg.org/specs/rfc9110.html#field.if-modified-since)
- [If-Unmodified-Since](https://httpwg.org/specs/rfc9110.html#field.if-unmodified-since)
- [If-Range](https://httpwg.org/specs/rfc9110.html#field.if-range)

The `Evaluator` also supports adding your own custom preconditions to be evaluated, should you need such.

Official Documentation
----------------------

[](#official-documentation)

Please read the [official documentation](https://aedart.github.io/athenaeum/) for additional information.

The mono repository is located at [github.com/aedart/athenaeum](https://github.com/aedart/athenaeum)

Versioning
----------

[](#versioning)

This package follows [Semantic Versioning 2.0.0](http://semver.org/)

License
-------

[](#license)

[BSD-3-Clause](http://spdx.org/licenses/BSD-3-Clause), Read the LICENSE file included in this package

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity77

Established project with proven stability

 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 ~12 days

Total

100

Last Release

68d ago

Major Versions

6.8.1 → 7.0.02023-02-16

7.33.0 → 8.0.02024-03-18

8.22.0 → 9.0.02025-03-04

PHP version history (5 changes)6.6.0PHP ^8.0.2

7.0.0PHP ^8.1

7.21.0PHP ^8.1.22

8.0.0PHP ^8.2

9.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b0ca9598955b15d361ffb37656bc1a2e698e8f0850645c1c3872f0b018ac9d2?d=identicon)[aedart](/maintainers/aedart)

---

Top Contributors

[![aedart](https://avatars.githubusercontent.com/u/1523223?v=4)](https://github.com/aedart "aedart (208 commits)")

---

Tags

generatorEtagAthenaeumEntity TagHTTP conditional requests

### Embed Badge

![Health badge](/badges/aedart-athenaeum-etags/health.svg)

```
[![Health](https://phpackages.com/badges/aedart-athenaeum-etags/health.svg)](https://phpackages.com/packages/aedart-athenaeum-etags)
```

###  Alternatives

[kevinrob/guzzle-cache-middleware

A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)

43117.4M104](/packages/kevinrob-guzzle-cache-middleware)[matthewbdaly/laravel-etag-middleware

A Laravel middleware for adding ETags to HTTP requests to improve response times

64326.0k2](/packages/matthewbdaly-laravel-etag-middleware)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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