Download the PHP package zemkogabor/xinfra-php without Composer

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

xinfra-php

PHP client for xInfra, a log collection and monitoring app. It sends log events and errors to the xInfra ingest API.

Using Laravel? Use xinfra-laravel, it is built on this package.

Requirements

Installation

Configuration

Client::fromEnvironment() reads these environment variables:

Variable Required Description
XINFRA_INGEST_URL yes The ingest endpoint, e.g. https://xinfra.example.com/api/ingest/events
XINFRA_INGEST_KEY yes The key of the log client
XINFRA_ENVIRONMENT yes Environment name, e.g. prod. It must exist on the project in xInfra.
XINFRA_LOG_LEVEL no Minimum level to send. Default: warning
XINFRA_RELEASE no Version of your app, e.g. a git tag

If the URL or the key is empty, sending is turned off and the client does nothing. This is handy in development and tests. If they are set, the environment is required too.

You can also create the config in code:

Usage

Plain PHP

ErrorHandler keeps the normal PHP behaviour: handlers registered before it are still called, and without them PHP prints and logs errors as usual. Errors silenced with @ are not sent.

If your app already has its own error handler, call the client from it instead:

Monolog

Long running processes

Buffered events are sent when a batch is full or when the process ends. A queue worker or a daemon may run for days, so call flush() after each job, otherwise rare errors wait in memory:

Processors

Processors can add data to every event, or drop an event by returning null:

GlobalRequestProcessor adds the URL, method, client IP and user agent of the current HTTP request from $_SERVER. It reads X-Forwarded-For and X-Forwarded-Proto by default. If your app is not behind a proxy, turn this off with new GlobalRequestProcessor(trustForwardedHeaders: false).

Event fields

Field Description
level, message PSR-3 level and the message
environment, release, server From the config
timestamp Time of the event
logger Name of the component. Events without an exception are grouped by logger and message.
fingerprint Custom grouping key
context Any extra data
tags Short key-value pairs for filtering
exception Type, message, file, line and stack trace
request, ip, userAgent, user The HTTP request and the user

Sensitive data (passwords, tokens) is masked and long fields are cut on the server side.

Development

License

MIT


All versions of xinfra-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-curl Version *
ext-json Version *
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 zemkogabor/xinfra-php contains the following files

Loading the files please wait ...