PHPackages                             duongnhathao/codeigniter-log-viewer - 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. duongnhathao/codeigniter-log-viewer

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

duongnhathao/codeigniter-log-viewer
===================================

This is a simple Log Viewer for viewing Code Igniter log files on the browser

1.1.4(4y ago)023MITPHPPHP &gt;=7.1

Since Jan 11Pushed 4y agoCompare

[ Source](https://github.com/duongnhathao/codeigniter-log-viewer)[ Packagist](https://packagist.org/packages/duongnhathao/codeigniter-log-viewer)[ RSS](/packages/duongnhathao-codeigniter-log-viewer/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (9)Used By (0)

CodeIgniter Log Viewer
======================

[](#codeigniter-log-viewer)

[![Latest Stable Version](https://camo.githubusercontent.com/3da2c48c4e9e85c9503d0bf13b4e0e69711e0ec9a8386ea4e3f17bdc13a0f5c1/68747470733a2f2f706f7365722e707567782e6f72672f7365756e6d6174742f636f646569676e697465722d6c6f672d7669657765722f762f737461626c65)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer) [![Total Downloads](https://camo.githubusercontent.com/b0d4dd0bad7278430ba3ed858444b3e95ff07940dec2ea1b4feee301bb9cacca/68747470733a2f2f706f7365722e707567782e6f72672f7365756e6d6174742f636f646569676e697465722d6c6f672d7669657765722f646f776e6c6f616473)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer) [![License](https://camo.githubusercontent.com/771e69b6b1c86a3c9b981d88286119e7b8a9f5166f589992fd56d94310851342/68747470733a2f2f706f7365722e707567782e6f72672f7365756e6d6174742f636f646569676e697465722d6c6f672d7669657765722f6c6963656e7365)](https://packagist.org/packages/seunmatt/codeigniter-log-viewer)

This is a simple Log Viewer for viewing CodeIgniter logs in the browser or via API calls (that returns a JSON response)

This project is inspired by the [laravel-log-viewer project](https://github.com/rap2hpoutre/laravel-log-viewer).

A typical log view looks like this:

[![sample.png](sample.png)](sample.png)

Usage
=====

[](#usage)

Requirement
-----------

[](#requirement)

- PHP &gt;= 7.1

Composer Installation
---------------------

[](#composer-installation)

Execute:

```
composer require duongnhathao/codeigniter-log-viewer

```

Controller Integration for Browser Display
------------------------------------------

[](#controller-integration-for-browser-display)

All that is required is to execute the `showLogs()` method in a Controller that is mapped to a route:

A typical Controller *(LogViewerController.php)* will have the following content:

```
private $logViewer;

public function __construct() {
    parent::__construct();
    $this->logViewer = new \CILogViewer\CILogViewer();
    //...
}

public function index() {
    echo $this->logViewer->showLogs();
    return;
}
```

Then the route *(application/config/routes.php)* can be configured thus:

```
$route['logs'] = "logViewerController/index";
```

And that's all! If you visit `/logs` on your browser you should see all the logs that are in *application/logs* folder and their content

Configuration
=============

[](#configuration)

- The folder path for log files can be configured by adding `clv_log_folder_path` to CodeIgniter's `config.php` file e.g.

`$config["clv_log_folder_path"] = APPPATH . "logs";`

- The file pattern for matching all the log files in the log folder can be configured by adding `clv_log_file_pattern` to CodeIgniter's `config.php` file e.g.

`$config["clv_log_file_pattern"] = "log-*.php";`

Viewing Log Files via API Calls
===============================

[](#viewing-log-files-via-api-calls)

If you're developing an API Service, powered by CodeIgniter, this library can still be used to view your log files.

Controller Setup
----------------

[](#controller-setup)

**The setup is the same as that mentioned above:**

- Create a Controller e.g. `ApiLogViewerController.php`,
- Create a function e.g. `index()`
- In the function, call `echo $this->logViewer->showLogs();`
- Finally, map your controller function to a route.

API Commands
------------

[](#api-commands)

The API is implemented via a set of query params that can be appended to the `/logs` path.

Query:

- `/logs?api=list` will list all the log files available in the configured folder

Response:

```
{
   "status": true,
   "log_files": [
       {
           "file_b64": "bG9nLTIwMTgtMDEtMTkucGhw",
           "file_name": "log-2018-01-19.php"
       },
       {
           "file_b64": "bG9nLTIwMTgtMDEtMTcucGhw",
           "file_name": "log-2018-01-17.php"
       }
   ]
}
```

**file\_b64 is the base64 encoded name of the file that will be used in further operations and API calls**

Query:

- `/logs?api=view&f=bG9nLTIwMTgtMDEtMTcucGhw` will return the logs contained in the log file specified by the `f` parameter.

The value of the `f` (*f stands for file*) is the base64 encoded format of the log file name. It is obtained from the `/logs?api=list` API call. A list of all available log files is also returned.

Response:

```
{
    "log_files": [
        {
            "file_b64": "bG9nLTIwMTgtMDEtMTkucGhw",
            "file_name": "log-2018-01-19.php"
        },
        {
            "file_b64": "bG9nLTIwMTgtMDEtMTcucGhw",
            "file_name": "log-2018-01-17.php"
        }
    ],
    "status": true,
    "logs": [
        "ERROR - 2018-01-23 07:12:31 --> 404 Page Not Found: admin/Logs/index",
        "ERROR - 2018-01-23 07:12:37 --> 404 Page Not Found: admin//index",
        "ERROR - 2018-01-23 15:23:02 --> 404 Page Not Found: Faviconico/index"
    ]
}
```

The API Query can also take one last parameter, `sline` that will determine how the logs are returned When it's `true` the logs are returned in a single line:

Query:

`/logs?api=view&f=bG9nLTIwMTgtMDEtMTkucGhw&sline=true`

Response:

```
{
   "log_files": [
       {
           "file_b64": "bG9nLTIwMTgtMDEtMTkucGhw",
           "file_name": "log-2018-01-19.php"
       },
       {
           "file_b64": "bG9nLTIwMTgtMDEtMTcucGhw",
           "file_name": "log-2018-01-17.php"
       }
   ],
   "status": true,
   "logs": "ERROR - 2018-01-23 07:12:31 --> 404 Page Not Found: admin/Logs/index\r\nERROR - 2018-01-23 07:12:37 --> 404 Page Not Found: admin//index\r\nERROR - 2018-01-23 15:23:02 --> 404 Page Not Found: Faviconico/index\r\n"
}
```

When it's `false` (**Default**), the logs are returned in as an array, where each element is a line in the log file:

Query:

`/logs?api=view&f=bG9nLTIwMTgtMDEtMTkucGhw&sline=false` OR `logs?api=view&f=bG9nLTIwMTgtMDEtMTkucGhw`

Response:

```
{

   "logs": [
       "ERROR - 2018-01-23 07:12:31 --> 404 Page Not Found: admin/Logs/index",
       "ERROR - 2018-01-23 07:12:37 --> 404 Page Not Found: admin//index",
       "ERROR - 2018-01-23 15:23:02 --> 404 Page Not Found: Faviconico/index"
   ]
}
```

Query:

`/logs?api=delete&f=bG9nLTIwMTgtMDEtMTkucGhw` will delete a single log file. The **f** parameter is the base64 encoded name of the file and can be obtained from the view api above.

Query:

`/logs?api=delete&f=all` will delete all log files in the configured folder path. Take note of the value for **f** which is the literal '**all**'.

**IF A FILE IS TOO LARGE (&gt; 50MB), YOU CAN DOWNLOAD IT WITH THIS API QUERY `/logs?dl=bG9nLTIwMTgtMDEtMTcucGhw`**

SECURITY NOTE
=============

[](#security-note)

**It is Highly Recommended that you protect/secure the route for your logs. It should not be an open resource!**

Contributions
=============

[](#contributions)

Found a bug? Kindly create an issue for it.

Want to contribute? Submit your pull-request(s)

Remember to ⭐ star the repo and share with friends

Author
======

[](#author)

Made with ❤️ by [Duong Nhat Hao](https://github.com/duongnhathao) base on [Seun Matt](https://smattme.com)

CHANGELOG
=========

[](#changelog)

[Changelog](CHANGELOG.md)

LICENSE
=======

[](#license)

[MIT](LICENSE)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% 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 ~251 days

Recently: every ~318 days

Total

7

Last Release

1588d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6.4

1.1.1PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49159916?v=4)[Duong Nhat Hao](/maintainers/duongnhathao)[@duongnhathao](https://github.com/duongnhathao)

---

Top Contributors

[![SeunMatt](https://avatars.githubusercontent.com/u/17220297?v=4)](https://github.com/SeunMatt "SeunMatt (28 commits)")[![duongnhathao](https://avatars.githubusercontent.com/u/49159916?v=4)](https://github.com/duongnhathao "duongnhathao (17 commits)")[![cijagani](https://avatars.githubusercontent.com/u/3807730?v=4)](https://github.com/cijagani "cijagani (2 commits)")[![sagarkaurav](https://avatars.githubusercontent.com/u/8871080?v=4)](https://github.com/sagarkaurav "sagarkaurav (1 commits)")[![semivan](https://avatars.githubusercontent.com/u/17897831?v=4)](https://github.com/semivan "semivan (1 commits)")

---

Tags

phplog viewerCode Igniter

### Embed Badge

![Health badge](/badges/duongnhathao-codeigniter-log-viewer/health.svg)

```
[![Health](https://phpackages.com/badges/duongnhathao-codeigniter-log-viewer/health.svg)](https://phpackages.com/packages/duongnhathao-codeigniter-log-viewer)
```

###  Alternatives

[seunmatt/codeigniter-log-viewer

This is a simple Log Viewer for viewing CodeIgniter log files on the browser

11190.9k1](/packages/seunmatt-codeigniter-log-viewer)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2839.2k9](/packages/inspector-apm-inspector-symfony)[melihovv/laravel-log-viewer

A Laravel log viewer

1231.6k1](/packages/melihovv-laravel-log-viewer)[eduardoarandah/backpacklogviewer

Integrate ArcaneDev/LogViewer in your Laravel-Backpack project

264.6k1](/packages/eduardoarandah-backpacklogviewer)

PHPackages © 2026

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