PHPackages                             frankflow/laravel-forge-logs - 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. frankflow/laravel-forge-logs

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

frankflow/laravel-forge-logs
============================

A Laravel Forge API wrapper for logs

v1.17(6mo ago)4291[3 PRs](https://github.com/FrankFlow/laravel-forge-logs/pulls)MITPHPPHP ^8.4CI passing

Since Oct 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/FrankFlow/laravel-forge-logs)[ Packagist](https://packagist.org/packages/frankflow/laravel-forge-logs)[ Docs](https://github.com/frankflow/laravel-forge-logs)[ GitHub Sponsors](https://github.com/FrankFlow)[ RSS](/packages/frankflow-laravel-forge-logs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (13)Versions (19)Used By (0)

[![Cover](./assets/cover.jpg)](./assets/cover.jpg)

Laravel Forge Logs
==================

[](#laravel-forge-logs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5b87aee8766d01b448604029199df8b4cdd0bd48e7f616c97c7180e445b9a458/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6672616e6b666c6f772f6c61726176656c2d666f7267652d6c6f67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/frankflow/laravel-forge-logs)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c426cc28b61eb019c9d63807fb0643718a2260a3e0426d56f4e4b83934ca64c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6672616e6b666c6f772f6c61726176656c2d666f7267652d6c6f67732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/frankflow/laravel-forge-logs/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3672ea83f450888d662bba85c62003cecb092ecda01b81a4ae31f78c3ab76090/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6672616e6b666c6f772f6c61726176656c2d666f7267652d6c6f67732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/frankflow/laravel-forge-logs/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/418eeebc459d155df01f1640867cdf1e80fc6c125a1d207a1a2bf305ea45a502/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6672616e6b666c6f772f6c61726176656c2d666f7267652d6c6f67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/frankflow/laravel-forge-logs)

A Laravel package that integrates with the [Laravel Forge API](https://forge.laravel.com/docs/api-reference/introduction) to fetch and manage application logs (laravel and nginx) from your Forge-managed sites. Simplify log retrieval and monitoring with interactive CLI commands.

Why this package
----------------

[](#why-this-package)

With the use of AI, it is increasingly necessary to access logs remotely to speed up bug fixing.

Features
--------

[](#features)

- Interactive setup wizard to configure your Forge organization, server, and site
- Fetch application logs directly from Laravel Forge
- Fetch nginx access logs from Laravel Forge
- Fetch nginx error logs from Laravel Forge
- Customizable log file paths and filenames
- Store logs locally for analysis
- Simple artisan commands for easy integration

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

[](#requirements)

- PHP 8.4+
- Laravel 11.x or 12.x

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

[](#installation)

You can install the package via Composer:

```
composer require frankflow/laravel-forge-logs --dev
```

Get Your Laravel Forge API Token
--------------------------------

[](#get-your-laravel-forge-api-token)

First, obtain your API token from Laravel Forge:

1. Log in to [Laravel Forge](https://forge.laravel.com)
2. Go to your account settings
3. Navigate to the API section
4. Generate a new API token (make sure you set the right scopes for the token)

Add Your Forge Token to .env
----------------------------

[](#add-your-forge-token-to-env)

Add the following line to your `.env` file:

```
FORGE_TOKEN=your-forge-api-token-here
```

Run the Interactive Setup
-------------------------

[](#run-the-interactive-setup)

Run the initialization command to configure your organization, server, and site:

```
php artisan forge-init
```

This interactive command will:

1. Fetch and display your available Forge organizations [![Forge Init Step 1](./assets/1.jpg)](./assets/1.jpg)
2. Fetch and display servers for the selected organization [![Forge Init Step 2](./assets/2.jpg)](./assets/2.jpg)
3. Allow you to search and select your site [![Forge Init Step 3](./assets/3.jpg)](./assets/3.jpg)
4. Automatically update your `.env` file with the configuration

USAGE: Fetching Logs
--------------------

[](#usage-fetching-logs)

Once configured, you can fetch different types of logs:

### Fetch All Logs (Recommended)

[](#fetch-all-logs-recommended)

```
php artisan forge-fetch-logs
# or
php artisan forge-all-logs
```

This command will fetch Laravel application logs, Nginx access logs, and Nginx error logs in sequence.

### Fetch Individual Logs

[](#fetch-individual-logs)

#### Application Logs

[](#application-logs)

```
php artisan forge-laravel-logs
```

Saves to `storage/logs/laravel.log` (customizable in config).

#### Nginx Access Logs

[](#nginx-access-logs)

```
php artisan forge-nginx-access-logs
```

Saves to `storage/logs/nginx/access.log` (customizable in config).

#### Nginx Error Logs

[](#nginx-error-logs)

```
php artisan forge-nginx-error-logs
```

Saves to `storage/logs/nginx/error.log` (customizable in config).

#### Delete Site Logs

[](#delete-site-logs)

```
php artisan forge-delete-logs
```

Interactively deletes logs on the configured site via the Forge API. The command presents a menu to select which logs to delete:

[![Forge Delete Step](./assets/laravel-forge-delete.png)](./assets/laravel-forge-delete.png)

**Options:**

Skip the confirmation prompt with `--force`:

```
php artisan forge-delete-logs --force
```

**⚠️ Warning**: Log deletion is permanent and cannot be undone.

\[Optional\] Publishing Configuration
-------------------------------------

[](#optional-publishing-configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag="forge-logs-config"
```

This will create a `config/forge-logs.php` file with the following structure:

```
return [
    'forge_token' => env('FORGE_TOKEN'),
    'forge_server_id' => env('FORGE_SERVER_ID'),
    'forge_site_id' => env('FORGE_SITE_ID'),
    'forge_organization' => env('FORGE_ORGANIZATION'),

    // Customize log file paths (relative to storage_path())
    'log_paths' => [
        'laravel' => 'logs/laravel.log',
        'nginx_access' => 'logs/nginx/access.log',
        'nginx_error' => 'logs/nginx/error.log',
    ],
];
```

### Customizing Log File Paths

[](#customizing-log-file-paths)

You can customize where the logs are saved by modifying the `log_paths` array in `config/forge-logs.php`:

```
'log_paths' => [
    'laravel' => 'logs/forge/laravel.log',           // Change path
    'nginx_access' => 'logs/forge/nginx-access.log', // Change path and filename
    'nginx_error' => 'logs/forge/nginx-error.log',   // Change path and filename
],
```

All paths are relative to the `storage_path()` directory.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [FrankFlow](https://github.com/FrankFlow)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance81

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 91.9% 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 ~2 days

Total

15

Last Release

187d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae6a91451d2a489d5573d14f0cd38335a6f09cdbf30126e1ae498db69c25e8a8?d=identicon)[frankflow](/maintainers/frankflow)

---

Top Contributors

[![FrankFlow](https://avatars.githubusercontent.com/u/7053026?v=4)](https://github.com/FrankFlow "FrankFlow (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelFrankFlowlaravel-forge-logs

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/frankflow-laravel-forge-logs/health.svg)

```
[![Health](https://phpackages.com/badges/frankflow-laravel-forge-logs/health.svg)](https://phpackages.com/packages/frankflow-laravel-forge-logs)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[spatie/laravel-error-share

Share your Laravel errors to Flare

43965.6k3](/packages/spatie-laravel-error-share)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

203330.1k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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