PHPackages                             netzindianer/laravel-file-notifier - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. netzindianer/laravel-file-notifier

ActiveLibrary[File &amp; Storage](/categories/file-storage)

netzindianer/laravel-file-notifier
==================================

Notify chosen services when specified file changes

1.2.6(4y ago)05361MITPHPPHP &gt;=8.0

Since Jan 20Pushed 4y ago2 watchersCompare

[ Source](https://github.com/netzindianer/laravel-file-notifier)[ Packagist](https://packagist.org/packages/netzindianer/laravel-file-notifier)[ RSS](/packages/netzindianer-laravel-file-notifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (15)Used By (0)

File Notifier
=============

[](#file-notifier)

[![Packagist Version](https://camo.githubusercontent.com/b2c3c3fac4a69d79ce748273abc53ef332de10c3c0ed11e6316724df4218db02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965723f6c6162656c3d56657273696f6e267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/b2c3c3fac4a69d79ce748273abc53ef332de10c3c0ed11e6316724df4218db02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965723f6c6162656c3d56657273696f6e267374796c653d666f722d7468652d6261646765)[![GitHub](https://camo.githubusercontent.com/afe570f464d4bcafafcb7831926f67c18a1a68b7880f32b96ddd697638555312/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965723f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/afe570f464d4bcafafcb7831926f67c18a1a68b7880f32b96ddd697638555312/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965723f7374796c653d666f722d7468652d6261646765)[![GitHub last commit (branch)](https://camo.githubusercontent.com/77f0dd9d3d2d08fddbf47a39c0e8fe8d6764592b0cbf02da0f06056cf82dcf70/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965722f6d61737465723f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/77f0dd9d3d2d08fddbf47a39c0e8fe8d6764592b0cbf02da0f06056cf82dcf70/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6e65747a696e6469616e65722f6c61726176656c2d66696c652d6e6f7469666965722f6d61737465723f7374796c653d666f722d7468652d6261646765)

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

[](#installation)

```
composer require netzindianer/laravel-file-notifier
php artisan vendor:publish --provider="Netzindianer\FileNotifier\FileNotifierProvider"
```

Usage
-----

[](#usage)

### Default

[](#default)

This module will check `config/file-notifier.php`, and if it finds config for any of senders, it will execute them

#### Command

[](#command)

```
php artisan file-notifier:default
```

#### CRON

[](#cron)

```
0 * * * * php artisan file-notifier:default >> /var/log/my_laravel_app_file_notifier.log
```

#### Laravel Schedule

[](#laravel-schedule)

[Documentation](https://laravel.com/docs/8.x/scheduling)

```
// Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule
        ->command('file-notifier:default')
        ->hourly()
        ->appendOutputTo(storage_path('logs/file-notifier.log'));
}
```

### Email

[](#email)

This module will use Laravel Mailable to send raw logs in mail content to specified addresses.

#### Command

[](#command-1)

```
php artisan file-notifier:email \
  --file-name=/var/www/html/storage/logs/laravel.log \
  --seconds=3600 \
  --lines=300 \
  --email=example@email.com \
  --email=another@email.com \
  --subject="My Laravel App - laravel.log"
```

#### CRON

[](#cron-1)

```
0 * * * * php artisan file-notifier:email --file-name=/var/www/html/storage/logs/laravel.log --seconds=3600 --lines=300 --email=example@email.com --email=another@email.com --subject="My Laravel App - laravel.log" >> /var/log/my_laravel_app_file_notifier.log
```

#### Laravel Schedule

[](#laravel-schedule-1)

[Documentation](https://laravel.com/docs/8.x/scheduling)

```
// Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule
        ->command('file-notifier:email', [
            '--file-name', '/var/www/html/storage/logs/laravel.log',
            '--seconds', '3600',
            '--lines', '300',
            '--email', 'example@email.com',
            '--email', 'another@email.com',
            '--subject', 'My Laravel App - laravel.log'
        ])
        ->hourly()
        ->appendOutputTo(storage_path('logs/file-notifier.log'));
}
```

### Discord

[](#discord)

This module will send logs as attachment to given webhook Documentation: [Here](https://discord.com/developers/docs/resources/webhook#execute-webhook)

#### Command

[](#command-2)

```
php artisan file-notifier:discord \
  --file-name=/var/www/html/storage/logs/laravel.log \
  --seconds=3600 \
  --lines=300 \
  --webhook-id=000000000000000000 \
  --webhook-token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
  --message="{\"username\":\"My Laravel App\",\"content\":\"laravel.log\"}"
```

#### CRON

[](#cron-2)

```
0 * * * * php artisan file-notifier:discord --file-name=/var/www/html/storage/logs/laravel.log --seconds=3600 --lines=300 --webhook-id=000000000000000000 --webhook-token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --message="{\"username\":\"My Laravel App\",\"content\":\"laravel.log\"}" >> /var/log/my_laravel_app_file_notifier.log
```

#### Laravel Schedule

[](#laravel-schedule-2)

[Documentation](https://laravel.com/docs/8.x/scheduling)

```
// Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule
        ->command('file-notifier:discord', [
            '--file-name', '/var/www/html/storage/logs/laravel.log',
            '--seconds', '3600',
            '--lines', '300',
            '--webhook-id', '000000000000000000',
            '--webhook-token', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
            '--message', '{"username":"My Laravel App","content":"laravel.log"}',
        ])
        ->hourly()
        ->appendOutputTo(storage_path('logs/file-notifier.log'));
}
```

### Own implementation

[](#own-implementation)

As example here is class, which will send logs in POST field to specified url File Notifier is using [xtompie/result](https://packagist.org/packages/xtompie/result) package to handle result

```
use Netzindianer\FileNotifier\FileNotifier;
use Xtompie\Result\Result;

class HttpPostNotifier
{
    public function __construct(
        protected FileNotifier $fileNotifier, // This class handles checking if there is any new content in file
        protected HttpPostNotifierSender $sender, // This is our callable to handle sending logs
    ) {}

    public function __invoke(string $url): Result
    {
        // Call FileNotifier with appropriate arguments
        $success = ($this->fileNotifier)(
            fileName: storage_path('logs/laravel.log'),
            seconds: 3600,
            lines: 300,
            sender: $this->sender->url($url),
        );
        return $success;
    }
}
```

```
use Illuminate\Http\Client\Factory as HttpFactory;

class HttpPostNotifierSender
{
    protected string $url;

    public function __construct(
        protected HttpFactory $http,
    ) {}

    public function url(string $url): static
    {
        $this->url = $url;
        return $this;
    }

    /**
    * @param string $content Last lines of specified file
    * @param string $fileName Name of file which was checked
    * @return bool FileNotifier will return result of this callable with Xtompie\Result\Result
     */
    public function __invoke(string $content, string $fileName): bool
    {
        $response = $this->http->post($this->url, [
            'fileName' => $fileName,
            'lastLinesOfFile' => $content,
        ]);
        return $response->successful();
    }
}
```

### Emails from database

[](#emails-from-database)

If you want, for example, call `file-notifier:email` but read addresses from database, api works exactly as above, so for emails you could do this:

```
use \Netzindianer\FileNotifier\FileNotifier;
use \Netzindianer\FileNotifier\Email\EmailSender;
use \App\Models\User;
use Xtompie\Result\Result;

class SendNewLogsToDevelopersUtil
{
    public function __construct(
        protected FileNotifier $notifier,
        protected EmailSender $emailSender,
    ) {}

    public function __invoke(): Result
    {
        $users = User::where('is_developer', true)->get();
        $emails = $users->map(fn(User $user) => $user->email);

        return ($this->notifier)(
            fileName: storage_path('logs/laravel.log'),
            seconds: 3600,
            sender: $this->emailSender
                ->emails($emails)
                ->subject("New logs for developers")
            lines: 300,
        );
    }
}
```

All notifiers in this package returns [xtompie results](https://packagist.org/packages/xtompie/result) with:

- `-1` if file not exists or there is nothing to send
- `NULL` if everything went correct
- Failure with exception message if something went wrong

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity62

Established project with proven stability

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 ~1 days

Total

14

Last Release

1562d ago

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/netzindianer-laravel-file-notifier/health.svg)

```
[![Health](https://phpackages.com/badges/netzindianer-laravel-file-notifier/health.svg)](https://phpackages.com/packages/netzindianer-laravel-file-notifier)
```

###  Alternatives

[overtrue/laravel-filesystem-qiniu

A Qiniu storage filesystem for Laravel.

482229.7k16](/packages/overtrue-laravel-filesystem-qiniu)[rahulhaque/laravel-filepond

Use FilePond the Laravel way

261114.4k2](/packages/rahulhaque-laravel-filepond)[overtrue/laravel-filesystem-cos

A Cos storage filesystem for Laravel.

92128.4k7](/packages/overtrue-laravel-filesystem-cos)

PHPackages © 2026

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