Download the PHP package rcezea/httplogger without Composer

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

HTTPLogger Class Documentation

Class Name: HttpLogger
Namespace: Rcezea\HttpLogger
Implements: Tracy\ILogger


Overview

The HttpLogger class implements the ILogger interface to send error logs to a server endpoint while providing optional local file logging. It supports both web and mobile platforms and enables environment-based logging modes (Development or Production).


Features

  1. Server-Side Logging: Sends logs to a configurable server endpoint.
  2. Optional File Logging: Logs success and failed attempts to local files for debugging.
  3. API Authentication: Supports optional credentials (appId and secretKey) for secure logging.
  4. Platform-Specific Logging: Configurable for web or mobile.
  5. Environment Modes: Differentiates between Development and Production modes.

Static Properties

Property Type Default Value Description
$endpoint string 'http://127.0.0.1:5000/errorhandler' Server endpoint URL for logs.
$mode bool Debugger::Development Logging mode: Development or Production.
$platform string 'web' Specifies platform: web or mobile.

Constructor

Method Signature:

Parameters:

Throws:


Static Methods

  1. setEndpoint(string $url): void
    Sets the logging server endpoint.
    Throws: \InvalidArgumentException if the URL is invalid.

  2. setMode(int $mode): void
    Sets the environment mode: Debugger::Development or Debugger::Production.
    Throws: \InvalidArgumentException for invalid modes.

  3. setPlatform(string $platform): void
    Sets the platform type (web or mobile).
    Throws: \InvalidArgumentException for invalid platforms.

Instance Methods

  1. log(mixed $value, string $level = ILogger::INFO): void
    Logs messages or exceptions to the server and optionally to local files.

    • $value (mixed): The message or exception to log.
    • $level (string): Log level, e.g., ILogger::INFO.

    Behavior:

    • Sends logs to the configured endpoint using cURL.
    • Includes optional API credentials.
    • Determines the mode (development or production) based on the static property.
    • Writes to local files if file logging is enabled.
  2. sendLogToServer(array $data): void
    Sends the prepared log data to the server endpoint using cURL.

  3. logToFile(string $filePath, array $data, string $response = ''): void
    Writes logs to the specified file path.

Logging to Files

If $logToFile is enabled during object instantiation, logs will be written to:

Format of File Logs:

For failed attempts, curl_error and server responses will be included.


Usage Example


Requirements


Changelog


License

This package is licensed under the MIT License.


Contributing

Contributions are welcome! Feel free to submit pull requests or open issues for improvements or bug fixes.


Author


Support

For questions, issues, or support, please contact [email protected].


All versions of httplogger with dependencies

PHP Build Version
Package Version
Requires tracy/tracy Version ^2.10
ext-curl 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 rcezea/httplogger contains the following files

Loading the files please wait ...