PHPackages                             phongtran/logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. phongtran/logger

ActivePackage[Logging &amp; Monitoring](/categories/logging)

phongtran/logger
================

A package which provides a simple logger

V2.0.4(11mo ago)4958MITPHPPHP ^8.0

Since Nov 21Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/mockingbitch/laravel-logger)[ Packagist](https://packagist.org/packages/phongtran/logger)[ RSS](/packages/phongtran-logger/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (9)Dependencies (3)Versions (15)Used By (0)

Logger Package for Laravel
==========================

[](#logger-package-for-laravel)

Introduction
------------

[](#introduction)

The Logger package provides advanced logging capabilities for Laravel applications. It allows you to easily record messages at various levels (such as warning, error, debug, etc.), log SQL queries, and store logs through a custom service. This package supports multiple logging channels, formats backtrace information, and integrates smoothly with Laravel's existing logging system.

Installation
------------

[](#installation)

```
  composer require phongtran/logger
```

After installation, you can publish the configuration file if needed:

```
  php artisan vendor:publish --tag=logger
```

Configuration
-------------

[](#configuration)

Make sure the required parameters are configured in the config/logger.php or .env file. You can add custom channels or use the default channels available in the package.

```
    ENABLE_QUERY_DEBUGGER=true
```

Usage
-----

[](#usage)

#### Logging Messages

[](#logging-messages)

To log various messages, use the Logger class. The package supports logging at different levels such as warning, error, debug, and info.

#### Log a Warning Message

[](#log-a-warning-message)

```
use phongtran\Logger\Logger;

Logger::warning('This is a warning message.');
```

#### Log an Exception Message

[](#log-an-exception-message)

```
use phongtran\Logger\Logger;

Logger::exception('Error occurred: Database connection failed.');
```

#### Log a Fatal Error Message

[](#log-a-fatal-error-message)

```
use phongtran\Logger\Logger;

Logger::fatal('A critical error occurred while processing the request.');
```

#### Log Debug Information

[](#log-debug-information)

```
use phongtran\Logger\Logger;

Logger::debug('Debugging application state: User has logged in.');
```

#### Log an Info Message

[](#log-an-info-message)

```
use phongtran\Logger\Logger;

Logger::info('User profile updated successfully.');
```

#### Log SQL Queries

[](#log-sql-queries)

To log SQL queries, you just need to add the configuration in the .env file. The Logger will listen to all queries and store them in the log\_queries table (by default).

```
ENABLE_QUERY_DEBUGGER=true
```

#### Log Activities

[](#log-activities)

Log all application requests, including the URL, parameters, response, and the execution time of the request. The activity log is configured in the `activity` middleware. To activate this middleware, you just need to add it to your routes.

```
Route::group(['middleware' => 'activity'], function () {
    Route::get('/', [HomeController::class, 'index']);
});
```

#### HTTP Exception

[](#http-exception)

Add this line in Handle Exceptions (bootstrap/app.php)

```
return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
    })
    ->withExceptions(function (Exceptions $exceptions) {
        \phongtran\Logger\LoggerHandler::handle($exceptions); //Log exceptions
    })->create();
```

Advanced Features
-----------------

[](#advanced-features)

#### Backtrace Formatting

[](#backtrace-formatting)

The Logger automatically adds backtrace information (file and line number) to logs to make debugging easier. This allows you to track the location where the log is generated in the code.

Example of a log message with backtrace:

```
 This is a debug message.
```

This helps you pinpoint exactly where the log message was triggered in your code.

Contributions
-------------

[](#contributions)

We welcome contributions from the community! If you would like to contribute, please fork the repository and submit a pull request with your improvements or bug fixes

License
-------

[](#license)

This package is licensed under the [MIT license](https://opensource.org/licenses/MIT). Please refer to the LICENSE file for more details.

Author
------

[](#author)

#### Phong Tran

[](#phong-tran)

Email: [jarvis.phongtran@gmail.com](https://github.com/mockingbitch)

GitHub: [github/mockingbitch](https://github.com/mockingbitch)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance52

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~0 days

Total

13

Last Release

331d ago

Major Versions

V1.2.0 → V2.02025-07-26

PHP version history (2 changes)V1.0.4PHP ^8.1

V2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7129e933f9426aebef8133cced58311cc99b9bc1675371380f562d313b89d0f6?d=identicon)[mockingbitch](/maintainers/mockingbitch)

---

Top Contributors

[![mockingbitch](https://avatars.githubusercontent.com/u/78545931?v=4)](https://github.com/mockingbitch "mockingbitch (7 commits)")[![phongtrantabtab](https://avatars.githubusercontent.com/u/201518155?v=4)](https://github.com/phongtrantabtab "phongtrantabtab (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phongtran-logger/health.svg)

```
[![Health](https://phpackages.com/badges/phongtran-logger/health.svg)](https://phpackages.com/packages/phongtran-logger)
```

###  Alternatives

[open-telemetry/opentelemetry-auto-laravel

OpenTelemetry auto-instrumentation for Laravel

582.4M8](/packages/open-telemetry-opentelemetry-auto-laravel)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14844.4k1](/packages/guanguans-laravel-exception-notify)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21313.7k3](/packages/ecotone-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
