Download the PHP package timdev/timdev-log without Composer

On this page you can find all versions of the php package timdev/timdev-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 timdev-log

timdev/log

(Very) Opinionated, structured, logging for PHP. Probably not for you.

Goals

This package represents my (admittedly evolving) approach to logging for PHP applications. It composes timdev/stack-logger with monolog to produce a distinct flavor of ndjson logs.

The main goal is to reduce the number of things I need to decide or remember when setting up logging in PHP application. Therefore, configuration knobs are intentionally minimized.

The Logger

The logger extends timdev/stack-logger's MonologStackLogger, providing a static factory with only three scalar arguments (only one of which is required). It also provides a couple of convenience methods to help log application events and exceptions. And that's it.

Included Middleware

StackLogger opens up some nice possibilities. Particularly in middleware-based web applications, it can be nice to add some persistent context to the logger instance early in the request, so it's included in all subsequent logging calls.

This library includes several StackLogger-aware PSR-15-compatible middleware that I've used in web app projects.

TimDev\Log\Middleware\LogRequestAttributes

Extracts request attributes from the PSR7 ServerRequest and adds them as context to the logger.

Example:

The middleware will not set context keys for null values.

For more example usage, see the tests

TimDev\Log\Middleware\DevelopmentRedirect

This middleware strips the Location header from redirect-responses and replaces the body with basic HTML document that includes a meta-refresh tag.

This is handy if you're using something like Monolog's BrowserConsoleHandler that relies on emitting javascript for the browser to execute in order to push log messages to the browser's console.

Example:

This middleware should usually be added early in your pipeline, since it only touches the response, and you want the response-mutation to happen last or nearly-last. In my projects, I typically do something like this:

Framework Integration

Mezzio

To date, I've been using this setup with Mezzio-based applications.

This package provides a ConfigProvider and a LoggerFactory.

To set this logger up in your mezzio project, just add the ConfigProvider in your config, and you'll have a logger in your container:

You can configure the logger in any of your config/autoload/*.php files as appropriate. A full configuration might look like:

config/autoload/timdev_log.local.php


All versions of timdev-log with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
monolog/monolog Version ^2.3
psr/container Version ^1.1
psr/http-server-middleware Version ^1.0
timdev/stack-logger Version ^0.1.0
timdev/typed-config Version ^0.1.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 timdev/timdev-log contains the following files

Loading the files please wait ....