Download the PHP package logger/ntfy without Composer

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

NtfyLogger

A small PSR-3 compatible logger and client for publishing messages to ntfy.

Requirements

Installation

Install the package with Composer:

Install a PSR-18 client and PSR-17 implementation if your application does not already provide them. For example:

Basic Usage

Configuration

NtfyConfiguration accepts the target topic, optional authentication, and the ntfy server URL:

For self-hosted ntfy instances, pass your own server URL:

Use either bearer-token authentication or username/password authentication. Configuring both will throw an InvalidArgumentException.

Sending Messages Directly

You can use NtfyClient without the PSR-3 logger:

Passing ntfy Parameters

The logger maps common context keys to ntfy headers:

url and ntfy_url are aliases for the notification click URL. When both are present, ntfy_url wins.

Exception Context

When the context contains an exception value and that value is a Throwable, the logger appends a compact Markdown exception report to the notification body and enables ntfy Markdown rendering.

The report renders the exception class, message, throw location, and stack trace in short line-based blocks so it remains readable on narrow phone screens. Files that belong to the application are highlighted in bold.

Directly below the original log message, the report also shows the runtime context. In a web request this is the current URL, preferably from ntfy_url; relative ntfy_url values are resolved against the request scheme and host. In CLI runs, the logger shows the command invocation when it is available through $_SERVER['argv'].

Configure exception path handling through NtfyExceptionConfiguration:

basePath is used to shorten absolute file names in the trace. applicationPaths defines which files should be highlighted. It does not filter the trace.

Use traceIncludePaths as a whitelist or traceExcludePaths as a blacklist for trace entries. Both can be combined; excluded paths take precedence. Relative application, include, and exclude paths are resolved below basePath. With no trace filters configured, all frames are retained.

For full control, pass an NtfyParams instance or an array under the ntfy context key:

Supported parameter keys are:

Log Level Defaults

When no custom ntfy parameters are provided, the logger derives priority and tags from the PSR-3 level:

PSR-3 level ntfy priority Default tags
emergency, alert, critical 5 rotating_light
error 4 warning
warning 3 triangular_flag_on_post
notice, info 2 information_source
debug and other levels 1 none

The default notification title is the uppercase log level, unless a title context value is provided.

Error Handling

By default, errors during HTTP transmission and response handling are suppressed (throwOnError: false). This includes transport exceptions and non-2xx HTTP responses. The call returns normally even if delivery fails; failed messages are not retried.

To propagate these errors to the application, enable throwOnError:

With this option enabled, non-2xx HTTP responses throw a RuntimeException containing the URL, status code, and response body when available. HTTP-client exceptions are rethrown unchanged.

The option applies to NtfyClient::sendMessage(), sendMessageWithAttachment(), and NtfyLogger. Configuration validation and request-construction errors still propagate regardless of this setting. NtfyExceptionConfiguration only controls how logged exceptions are rendered.

Testing

Run the PHPUnit suite with Composer:

License

Proprietary.


All versions of ntfy with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/http-client Version >= 1.0
psr/http-factory Version >= 1.0
psr/http-message Version >= 1.0
psr/log Version >= 1.0
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 logger/ntfy contains the following files

Loading the files please wait ...