Download the PHP package nanayawkumi/nyk-logger without Composer

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

nyk-logger

PHP Laravel License

Lightweight Laravel package (10 → 13) that globally catches application errors and exceptions and dispatches structured alerts through pluggable channels — email via the Brevo Transactional API v3 and/or Slack — completely bypassing your host app's SMTP configuration.

Built for production noise control and safety:

Contents

Requirements

Installation

The service provider is auto-discovered. Optionally publish the config and/or the email view:

Configuration

The only keys you need in your .env are the Brevo credentials:

Everything else ships with sensible defaults baked into the config file. To change any of them (channels, capture sources, queue, cooldown, rate limit, ignore/redaction rules, the Slack webhook, ...), publish the config and edit the value directly:

Capture sources

The package captures problems from two independent, individually toggleable sources:

1. The log pipeline — reacts to log entries at the configured levels:

2. The exception handler — decorates Laravel's handler to catch uncaught exceptions the framework doesn't log by default, such as 500 server errors and selected 4xx (403, 404). Choose exactly what to alert on by HTTP status and/or exception class:

Both sources feed the same cooldown and rate cap, so an error caught by both (e.g. a logged 500) is de-duplicated into a single alert.

Configuration reference

Only the Brevo mail.* keys read from the environment; everything else is a literal default you edit in the published config file.

Key Env var (mail only) Default Description
enabled — true Master switch.
environments — ['production'] Environments where capture is active.
log.enabled — true Capture from the log pipeline.
log.levels — error, critical, alert, emergency Log levels that trigger an alert.
exceptions.enabled — true Capture uncaught exceptions from the handler.
exceptions.http_statuses — [500] Statuses to alert on (500 also matches >=500).
exceptions.types — [] Throwable classes to alert on regardless of status.
channels — ['mail'] Active channels (mail, slack).
mail.api_key NYK_LOGGER_API_KEY null Brevo v3 API key.
mail.to_email NYK_LOGGER_EMAIL null Recipient address.
mail.to_name NYK_LOGGER_NAME System Administrator Recipient name.
mail.from_email NYK_LOGGER_FROM_EMAIL MAIL_FROM_ADDRESS Verified Brevo sender.
mail.from_name NYK_LOGGER_FROM_NAME APP_NAME Sender name.
slack.webhook_url — null Slack incoming webhook URL.
queue.enabled — false Push delivery onto the queue.
queue.connection — null Queue connection (null = default).
queue.queue — default Queue name.
cooldown — 30 Minutes an identical error is suppressed.
rate_limit.max — 20 Max alerts per window (0 disables).
rate_limit.decay — 60 Rate window in minutes.
ignore_exceptions — [] Exception classes (incl. subclasses) to skip.
ignore_messages — [] Regex patterns; matching messages are skipped.
redact.keys — common secrets Context/request keys to replace with [REDACTED].
redact.patterns — bearer tokens Value regexes to scrub.

Verify your setup

Fires a sample alert through every enabled channel and reports per-channel success/failure — no need to trigger a real error. If required keys are missing for an active channel, a warning is also logged automatically at console/boot time so misconfiguration surfaces during deploys.

How it works

  1. On boot the package checks it is enabled and the current environment is in environments. If not, it registers nothing (zero overhead).
  2. Two capture sources feed the pipeline (each independently toggleable): a global Log::listen() handler for the configured log.levels, and a decorator around the framework's exception handler that catches uncaught exceptions matching your exceptions.http_statuses / exceptions.types.
  3. Ignore rules drop matching exception classes / message patterns.
  4. A fingerprint is derived from the exception (file + line + code) or the message string, checked against a cooldown cache entry.
  5. A global rate cap limits total alerts per window across all errors.
  6. Request context (URL, method, IP, user, input) is captured and redacted, then a SendAlertJob fans it out to every enabled channel — queued by default so the failing request is never slowed down.

Failure safety

Manual reporting API

Trigger alerts intentionally from anywhere in your app via the facade. Manual calls bypass the log-level filter (they're explicit) but still respect the cooldown and rate cap:

Lifecycle events

Hook into delivery with standard Laravel events:

Event When Payload
Events\AlertSending Just before dispatch (synchronous, cancellable) AlertPayload $payload
Events\AlertSent After fan-out to channels AlertPayload $payload, array<string,bool> $results
Events\AlertSuppressed When filtered out string $reason (ignored/cooldown/rate_limit/cancelled), plus level/message/fingerprint

Return false from an AlertSending listener to cancel an alert:

Prefer a destination that isn't built in (PagerDuty, Sentry, a database row)? Listen for AlertSent and forward the immutable AlertPayload yourself — no need to modify the package:

Custom grouping (fingerprint)

By default alerts are grouped by file + line + code (or the message for text logs). Override grouping with your own resolver, e.g. in a service provider's boot():

Customising the email template

Publish and edit the Blade view — it receives the full AlertPayload data:

Available variables: level, title, message, environment, appName, exceptionClass, file, line, code, trace, url, method, ip, userAgent, userId, context (redacted), timestamp, fingerprint.

Package structure

Testing

License

MIT


All versions of nyk-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0|^11.0|^12.0|^13.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 nanayawkumi/nyk-logger contains the following files

Loading the files please wait ...