phalcon / bridge-psr3
Phalcon Framework bridge classes for PSR-3
Requires
- php: >=8.1 <9.0
- psr/log: ^3.0
Requires (Dev)
- infection/infection: ^0.28
- pds/skeleton: ^1.0
- phalcon/ide-stubs: ^5.6
- phalcon/phalcon: ^6.0@alpha
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: ^3.8
- 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-06-25 09:21:13 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);