phalcon / bridge-psr3
Phalcon Framework bridge classes for PSR-3
Requires
- php: >=8.1 <9.0
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- pds/skeleton: ^1.0
- phalcon/ide-stubs: ^5.6
- phalcon/phalcon: ^6.0@alpha
- phalcon/talon: ^0.6.0
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^4.0
- vlucas/phpdotenv: ^5.6
Suggests
- ext-phalcon: Provides Phalcon\Logger via the C extension (alternative to phalcon/phalcon)
- phalcon/phalcon: Provides Phalcon\Logger via the PHP implementation
This package is auto-updated.
Last update: 2026-07-14 17:05:56 UTC
README
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-3 connects the Phalcon logger and the PSR-3 (Psr\Log\LoggerInterface) standard in both directions:
Logger- a PSR-3 logger backed by Phalcon's logging adapters. Use it wherever aPsr\Log\LoggerInterfaceis expected.Adapter- a Phalcon log adapter that forwards to a PSR-3 logger. Use it to make any PSR-3 logger (e.g. Monolog) act as a Phalcon log target.
Installation
You can install the package using composer
composer require phalcon/bridge-psr3
Usage
Logger - use Phalcon logging through a PSR-3 interface
Phalcon\Bridge\Psr3\Logger is a Psr\Log\LoggerInterface, configured with
Phalcon logging adapters. Hand it to any code that expects a PSR-3 logger.
use Phalcon\Bridge\Psr3\Logger; use Phalcon\Logger\Adapter\Stream; $logger = new Logger( 'my-app', [ 'main' => new Stream('/var/log/app.log'), ] ); // $logger is a Psr\Log\LoggerInterface $logger->info('User logged in', ['id' => 42]); $logger->error('Payment failed');
Adapter - use a PSR-3 logger as a Phalcon log target
Phalcon\Bridge\Psr3\Adapter is a Phalcon log adapter that forwards to a
wrapped PSR-3 logger. Add it to a Phalcon\Logger\Logger and inject that
wherever Phalcon expects a logger.
use Phalcon\Bridge\Psr3\Adapter; use Phalcon\Logger\Logger; // Any Psr\Log\LoggerInterface, e.g. Monolog $psr = new Monolog\Logger('my-app'); $logger = new Logger( 'my-app', [ 'psr' => new Adapter($psr), ] ); // Phalcon log calls now flow into the PSR-3 logger $logger->warning('Low disk space'); // e.g. inject into the DataMapper profiler, which expects a Phalcon logger $profiler = new Phalcon\DataMapper\Pdo\Profiler\Profiler($logger);
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
docker compose up -d --build docker compose exec app composer install docker compose exec app composer test
appis the Compose service name. The running container isbridge-psr3-app(override withPROJECT_PREFIX). It stays up via asleep infinitykeepalive, so you candocker compose exec app <cmd>freely (e.g.composer update).
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-psr3-81 docker compose -p bridge-psr3-81 up -d --build
# then: docker exec -w /srv bridge-psr3-81-app composer test
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
Run them inside the container, e.g. docker compose exec app composer cs:
| Script | Description |
|---|---|
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 |
composer test-coverage |
Tests + Clover coverage (tests/_output/coverage.xml) |