PHPackages                             phalcon/bridge-psr16 - 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. [Framework](/categories/framework)
4. /
5. phalcon/bridge-psr16

ActiveLibrary[Framework](/categories/framework)

phalcon/bridge-psr16
====================

Phalcon Framework bridge classes for PSR-16

v3.0.0(1mo ago)012MITPHP &gt;=8.1 &lt;9.0

Since Jul 6Compare

[ Source](https://github.com/phalcon/bridge-psr16)[ Packagist](https://packagist.org/packages/phalcon/bridge-psr16)[ GitHub Sponsors](https://github.com/phalcon)[ Fund](https://opencollective.com/phalcon)[ RSS](/packages/phalcon-bridge-psr16/feed)WikiDiscussions Synced 1w ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Phalcon Framework - Bridge PSR-16
=================================

[](#phalcon-framework---bridge-psr-16)

[![Bridge PSR-16 CI](https://github.com/phalcon/bridge-psr16/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/phalcon/bridge-psr16/actions/workflows/main.yml)[![Quality Gate Status](https://camo.githubusercontent.com/15a7b23ac4b8750ca706609f2d11ddd407e3fba1ade8c1a61294ec3da3b54e3e/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068616c636f6e5f6272696467652d7073723136266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=phalcon_bridge-psr16)[![Coverage](https://camo.githubusercontent.com/05fab01831be25251040067c48bc44e9c0765b5aea6fc9fcdd53207fa10d2097/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068616c636f6e5f6272696467652d7073723136266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=phalcon_bridge-psr16)[![PDS Skeleton](https://camo.githubusercontent.com/50d01a5094afcc3a827c3cadaec43d23b2a256cb249f5fdd6e5ffdb53ea7971c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-pds/skeleton)

Phalcon is an open source web framework delivered as a C extension for the PHP language providing high performance and lower resource consumption.

Bridge PSR-16 connects the Phalcon cache and the PSR-16 (`Psr\SimpleCache\CacheInterface`) standard in both directions:

- **`Cache`** - a PSR-16 cache backed by a Phalcon cache adapter. Use it wherever a `Psr\SimpleCache\CacheInterface` is expected.
- **`Adapter`** - a Phalcon cache adapter that forwards to a PSR-16 cache. Use it to make any PSR-16 cache (e.g. Symfony Cache) act as a Phalcon cache backend.

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

[](#installation)

You can install the package using composer

```
composer require phalcon/bridge-psr16
```

Usage
-----

[](#usage)

### `Cache` - use a Phalcon cache through a PSR-16 interface

[](#cache---use-a-phalcon-cache-through-a-psr-16-interface)

`Phalcon\Bridge\Psr16\Cache` *is* a `Psr\SimpleCache\CacheInterface`, backed by a Phalcon cache adapter. Hand it to any code that expects a PSR-16 cache.

```
use Phalcon\Bridge\Psr16\Cache;
use Phalcon\Cache\AdapterFactory;
use Phalcon\Storage\SerializerFactory;

$serializerFactory = new SerializerFactory();
$adapterFactory    = new AdapterFactory($serializerFactory);
$adapter           = $adapterFactory->newInstance('memory');

$cache = new Cache($adapter);

// $cache is a Psr\SimpleCache\CacheInterface
$cache->set('user.42', ['name' => 'Phalcon'], 3600);
$data = $cache->get('user.42');
```

### `Adapter` - use a PSR-16 cache as a Phalcon cache backend

[](#adapter---use-a-psr-16-cache-as-a-phalcon-cache-backend)

`Phalcon\Bridge\Psr16\Adapter` is a Phalcon cache adapter that forwards to a wrapped PSR-16 cache. Use it to back a `Phalcon\Cache\Cache` with any PSR-16 implementation.

```
use Phalcon\Bridge\Psr16\Adapter;
use Phalcon\Cache\Cache;
use Phalcon\Storage\SerializerFactory;

// Any Psr\SimpleCache\CacheInterface, e.g. Symfony's Psr16Cache
$psr = new Symfony\Component\Cache\Psr16Cache(/* ... */);

$adapter = new Adapter(new SerializerFactory(), $psr);
$cache   = new Cache($adapter);

// Phalcon cache calls now flow into the PSR-16 cache
$cache->set('key', 'value');
```

Development
-----------

[](#development)

The repository ships a Docker setup for local development and testing. You only need Docker + Docker Compose; the PHP runtime and Phalcon are provided inside the container.

### Quick start

[](#quick-start)

```
docker compose up -d --build
docker compose exec app composer install
docker compose exec app composer test
```

> `app` is the Compose *service* name. The running container is `bridge-psr16-app` (override with `PROJECT_PREFIX`). It stays up via a `sleep infinity` keepalive, so you can `docker compose exec app ` freely (e.g. `composer update`).

### Choosing the PHP version

[](#choosing-the-php-version)

The image is built for one PHP version at a time, selected with the `PHP_VERSION` build arg (default `8.5`; supported `8.1`–`8.5`). Because it is a **build** arg, changing it requires a rebuild (`--build`):

```
docker compose up -d --build                  # PHP 8.5 (default)
PHP_VERSION=8.1 docker compose up -d --build  # PHP 8.1
PHP_VERSION=8.4 docker compose up -d --build  # PHP 8.4
```

The container keeps the same name, so each rebuild **replaces** the previous one. To run several versions side by side, give each its own Compose project and prefix:

```
PHP_VERSION=8.1 PROJECT_PREFIX=bridge-psr16-81 docker compose -p bridge-psr16-81 up -d --build
# then: docker exec -w /srv bridge-psr16-81-app composer test
```

### Choosing the backend

[](#choosing-the-backend)

The bridge works against either Phalcon runtime, selected with the `PHALCON_VARIANT` build arg:

```
docker compose up -d --build                     # package: phalcon/phalcon (v6, default)
PHALCON_VARIANT=ext docker compose up -d --build  # ext: cphalcon C extension (v5)
```

Tip: drop `PHP_VERSION` / `PHALCON_VARIANT` into a `.env` file in the repo root to avoid prefixing every command — Compose reads it automatically.

### Composer scripts

[](#composer-scripts)

Run them inside the container, e.g. `docker compose exec app composer cs`:

ScriptDescription`composer cs`PHP\_CodeSniffer (PSR-12)`composer cs-fix`Auto-fix coding-standard issues (phpcbf)`composer cs-fixer`PHP CS Fixer (dry-run)`composer cs-fixer-fix`Apply PHP CS Fixer`composer analyze`PHPStan static analysis`composer test` / `composer test-unit`Unit tests via [`phalcon/talon`](https://github.com/phalcon/talon)`composer test-coverage`Tests + Clover coverage (`tests/_output/coverage.xml`)Links
-----

[](#links)

### General

[](#general)

- [Official Documentation](https://docs.phalcon.io/)

### Support

[](#support)

- [Forum](https://phalcon.io/forum)
- [Discord](https://phalcon.io/discord)
- [Stack Overflow](https://phalcon.io/so)

### Social Media

[](#social-media)

- [Telegram](https://phalcon.io/telegram)
- [Gab](https://phalcon.io/gab)
- [LinkedIn](https://phalcon.io/linkedin)
- [MeWe](https://phalcon.io/mewe)
- [Facebook](https://phalcon.io/fb)
- [Twitter](https://phalcon.io/t)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

49d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1221505?v=4)[The Phalcon PHP Framework](/maintainers/phalcon)[@phalcon](https://github.com/phalcon)

---

Tags

phpframeworkpsr-16phalcon

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phalcon-bridge-psr16/health.svg)

```
[![Health](https://phpackages.com/badges/phalcon-bridge-psr16/health.svg)](https://phpackages.com/packages/phalcon-bridge-psr16)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.5k](/packages/laravel-framework)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.9k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[nutgram/nutgram

The Telegram bot library that doesn't drive you nuts

740315.8k8](/packages/nutgram-nutgram)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[doppar/framework

The Doppar Framework

4112.6k14](/packages/doppar-framework)

PHPackages © 2026

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