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

ActiveLibrary

seunmatt/codeigniter-log-viewer
===============================

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

2.0.3(5mo ago)10884.8k↑14.6%43[1 issues](https://github.com/SeunMatt/codeigniter-log-viewer/issues)1MITPHPPHP &gt;=7.4

Since Jan 11Pushed 5mo ago7 watchersCompare

[ Source](https://github.com/SeunMatt/codeigniter-log-viewer)[ Packagist](https://packagist.org/packages/seunmatt/codeigniter-log-viewer)[ RSS](/packages/seunmatt-codeigniter-log-viewer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)DependenciesVersions (11)Used By (1)

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)

**For CodeIgniter 3, see this [reference guide](https://github.com/SeunMatt/codeigniter-log-viewer/wiki/CodeIgniter-3-Guide)**

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- CodeIgniter 4

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

[](#composer-installation)

```
composer require seunmatt/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:

```
namespace App\Controllers;
use CILogViewer\CILogViewer;

class LogViewerController extends BaseController
{
    public function index() {
        $logViewer = new CILogViewer();
        return $logViewer->showLogs();
    }
}
```

Then the route `app/Config/Routes.php` can be configured like:

```
$routes->get('logs', "LogViewerController::index");
```

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

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

[](#configuration)

The package allows you to configure some of its parameters by creating a `CILogViewer` class in CodeIgniter's `Config` folder and then adding the following variables:

- The folder path for log files can be configured with the `$logFolderPath` config var.
- The file pattern for matching all the log files in the log folder can be configured by adding `$logFilePattern` config var.
- The name of the view that renders the logs page can be changed using the `$viewName` config var. Please note that this can be a route relative to your `View` path or a namespace route.

Example configuration file `app/Config/CILogViewer.php`:

```
