Download the PHP package michaelmoussa/zend-psr-log without Composer

On this page you can find all versions of the php package michaelmoussa/zend-psr-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package zend-psr-log

Build Status Scrutinizer Code Quality Code Climate Code Coverage Latest Stable Version License

zend-psr-log

Overview

A number of PHP libraries accept a Psr\Log\LoggerInterface for logging messages. Unfortunately, applications using Zend Framework 2 cannot provide their existing Zend\Log\Logger loggers, as they don't comply with PSR-3.

In fact, the two interfaces are not compatible, as they declare some common methods with different signatures. For example: Zend alert vs. Psr alert.

This library serves as a backwards-compatible replacement for Zend\Log\Logger instances that provides a Psr\Log-compliant interface to the underlying Zend\Log\Logger instance. The result is that you can provide either logger depending on the interface required by a given context, while still having all messages go through Zend\Log\Logger and benefiting from its robustness.

Installation

The only supported method of installation is Composer.

composer require "michaelmoussa/zend-psr-log"

Configuration

To begin, you must add the ZendPsrLog module to your application.config.php module list as with any ZF2 application.

Further configuration depends on how you are presently getting your instances of a Zend\Log\Logger.

"I define a log entry in my configuration with Zend\Log\Logger as the key, and then let Zend\Log\LoggerAbstractServiceFactory do the work."

Then you're done! ZendPsrLog adds its own factory for creating Zend\Log\Logger instances, which will be invoked before the Abstract Factory.

"I define a log entry in my configuration with a different key, then let Zend\Log\LoggerAbstractServiceFactory do the work."

For each key you use, you'll need to add a 'My\Key\Here' => new \ZendPsrLog\LoggerFactory('My\Key\Here') entry to your service manager config.

"I define a log key in my configuration with no key, and then have my own 'Zend\Log\Logger' => '...' factory definition in the service manager config"

You need to replace your 'Zend\Log\Logger' => '...' entry with 'Zend\Log\Logger' => new \ZendPsrLog\LoggerFactory(null), as your definition will override the one done by the ZendPsrLog\LoggerFactory.

If your custom factory is doing some special logic, you will have to extend ZendPsrLog\LoggerFactory on your own to ensure it persists.

"I use new \Zend\Log\Logger(...)."

  1. Please don't. :) You should be using the ServiceManager.
  2. Replace new \Zend\Log\Logger with new \ZendPsrLog\Logger.

Usage

As a Zend\Log\LoggerInterface

The ZendPsrLog\Logger is an extension of Zend\Log\Logger, so any class you have in your application that is presently using a Zend\Log\Logger can use the ZendPsrLog\Logger without any additional configuration.

As a Psr\Log\LoggerInterface

Suppose you have a class that requires a Psr\Log\LoggerInterface instance:

And you obtain an instance of the ZendPsrLog\Logger:

Just use the ->getPsrLogger() method to obtain a Psr\Log\LoggerInterface to your existing Zend\Log\Logger:


All versions of zend-psr-log with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
psr/log Version ~1.0
zendframework/zend-log Version ~2.1
zendframework/zend-modulemanager Version ~2.1
zendframework/zend-mvc Version ~2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package michaelmoussa/zend-psr-log contains the following files

Loading the files please wait ....