Download the PHP package oluokunkabiru/api-call-logger without Composer

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

API Call Logger

Provider-agnostic Laravel logger for third-party API calls and incoming webhooks. Every call is stored with its request, response, headers, status, latency and outcome, with credentials and PII redacted before they touch the database. It also gives you retries, pruning and a built-in dashboard.

It replaces the hand-rolled ThirdPartyApiLogger service you would otherwise copy into every project.

Requirements

Laravel 10 and 11 are end-of-life. Composer now blocks every release of them because of unpatched security advisories, so they are not supported.

Installation

The service provider and ApiCallLogger facade are auto-discovered. Optionally publish the config:

Environment variables

Every option can be set from .env without publishing the config. See .env.example for the full list with defaults. The most common ones:

Every feature that changes what is stored or sent has its own switch, so each application decides. Nothing extra is sent to providers unless you switch it on (correlation header, idempotency key).

Comma-separated values are used for lists (hosts, extra redaction keys, dashboard middleware).

For local development of this package, add a path repository to the app's composer.json:

Usage

1. Outbound calls through Laravel's Http client (recommended)

The request is timed and logged with its headers, body, status and response. Your code gets the normal Response back. Connection failures are logged too, and the exception is still thrown as usual.

Options (third argument):

ApiCallLogger::http('vtpass', 'buy-airtime') does the same thing as Http::withApiLogging(...). For a custom Guzzle client, push ApiCallLogger::middleware('vtpass') onto its handler stack.

2. Automatic capture of every Http client call

Hosts that don't match a provider are logged under their hostname. A call made with withApiLogging() is only logged once, even when capture is enabled.

3. Inbound webhooks

Inbound records have direction = inbound, the caller's IP in meta.ip, and your app's response as response_body. Uploaded files are stored as name, MIME type and size only.

4. Anything else (SOAP, raw cURL, vendor SDKs)

Request-scoped context

Set these once per request (in a middleware, for example). They apply to every call logged afterwards:

All calls logged during one request share a correlation_id. The dashboard lists them together, so you can follow a whole flow (e.g. verify BVN → create wallet → fund).

Setting Default Effect
correlation.propagate_to_jobs true Queued jobs dispatched by the request keep the same id (Laravel 11+ Context)
correlation.share_with_logs false The id also appears on every Log:: line
correlation.request_header null Adopt the caller's id, e.g. X-Request-Id, or traceparent to reuse the OpenTelemetry trace id
correlation.forward_header null Send the id to providers, e.g. X-Correlation-ID

Retry attempts and idempotency keys

Redaction

Value patterns

Key names miss secrets stored under unexpected keys, inside free text, or in the URL itself. Value patterns catch them by what they look like. Each one has its own switch:

Card masking checks the Luhn checksum first, so order references and amounts are left alone.

Encryption at rest

Erasure requests (GDPR / NDPR)

Retrying calls

Replaying a payment can charge twice, so you decide how strict retry is:

Outcome When Result
Blocked retry disabled, inbound webhook, payload redacted/masked/truncated, multipart/binary body, deny mode, missing required idempotency key, max_per_log reached, retry already running RetryNotPossible. force does not help
Needs confirmation non-idempotent method in confirm mode, or a call that already succeeded with only_failed RetryNeedsConfirmation unless force: true. The dashboard shows the risks and an "I understand" checkbox
Allowed everything else Replayed and logged with retry_of_id pointing at the original

Credentials are never stored, so retry gets authentication headers from your config or a resolver:

Dashboard

Visit /api-call-logs (configurable with dashboard.route_prefix). Access is controlled by two gates. Like Telescope, they only allow the local environment until you define them:

Add auth (or your admin guard) to dashboard.middleware, or turn the dashboard off with API_CALL_LOGGER_DASHBOARD_ENABLED=false if you use Filament (see below).

Using it from Filament

Point a resource at the package model:

Querying

Alerts

Queueing and pruning

php artisan api-call-logger:prune --days=7 --provider=vtpass

Migrating from a project-level ThirdPartyApiLogger

Before After
$start = microtime(true); $res = Http::...->post(); ThirdPartyApiLogger::log(...) $res = Http::withApiLogging('vtpass', $context)->...->post()
ThirdPartyApiLogger::log(provider:, method:, endpoint:, ...) ApiCallLogger::log(provider:, method:, url:, ...)
ThirdPartyApiLogger::redact($x) ApiCallLogger::redactor()->redact($x)
institution_code column tenant (set with withTenant() / resolveTenantUsing())
masspay_transaction_id column loggable (any model)
LogIncomingWebhook middleware api-call-logger.inbound
Per-provider match in the Filament Retry action providers.*.retry_headers / retryHeadersUsing()

Testing

Tests use in-memory SQLite when pdo_sqlite is installed. Otherwise they use the MySQL database configured in phpunit.xml.dist (api_call_logger_test).

License

MIT


All versions of api-call-logger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.5
illuminate/database Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^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 oluokunkabiru/api-call-logger contains the following files

Loading the files please wait ...