PHPackages                             alyakin/reporting - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. alyakin/reporting

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

alyakin/reporting
=================

Flexible Laravel package for attaching user reports to any model. Useful for moderation, feedback, and auditing.

v1.0.7(1y ago)08[9 issues](https://github.com/2177866/reporting/issues)MITPHPPHP ^8.0CI passing

Since Jan 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/2177866/reporting)[ Packagist](https://packagist.org/packages/alyakin/reporting)[ Docs](https://github.com/2177866/reporting)[ RSS](/packages/alyakin-reporting/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Laravel Complaint &amp; Note Manager
====================================

[](#laravel-complaint--note-manager)

[![Packagist Version](https://camo.githubusercontent.com/abcf4a32c2a3f952f75478342a7efccbbfd6cfbf204e4854c041a7fc437ad33e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c79616b696e2f7265706f7274696e67)](https://packagist.org/packages/alyakin/reporting)[![Downloads](https://camo.githubusercontent.com/becbc5585c37e6368710b809a962402a069257a638d38de04a54d3c4d6ffccac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c79616b696e2f7265706f7274696e67)](https://packagist.org/packages/alyakin/reporting)[![Laravel 9+](https://camo.githubusercontent.com/2007f8c62ec889a984a41ecca96a5a6d201d250def43e15131a8c646a87d7215/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532422d6f72616e6765)](https://camo.githubusercontent.com/2007f8c62ec889a984a41ecca96a5a6d201d250def43e15131a8c646a87d7215/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532422d6f72616e6765)[![PHP 8+](https://camo.githubusercontent.com/8e616b32ea6d2562125d6120fddeedd8bddd16548f82d100ebe6a50980445733/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382532422d626c7565)](https://camo.githubusercontent.com/8e616b32ea6d2562125d6120fddeedd8bddd16548f82d100ebe6a50980445733/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382532422d626c7565)[![MIT License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENCE)

[![PHPUnit](https://github.com/2177866/reporting/actions/workflows/phpunit.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/phpunit.yml)[![Laravel Pint](https://github.com/2177866/reporting/actions/workflows/pint.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/pint.yml)[![Larastan](https://github.com/2177866/reporting/actions/workflows/larastan.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/larastan.yml)[![Larastan Level](https://camo.githubusercontent.com/68504ee43cdca2c2218958214d43d36a36220a922864ec38d5f8e3dce6f62497/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6172617374616e2d6c6576656c253230392d626c756576696f6c6574)](https://camo.githubusercontent.com/68504ee43cdca2c2218958214d43d36a36220a922864ec38d5f8e3dce6f62497/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6172617374616e2d6c6576656c253230392d626c756576696f6c6574)

**Laravel Complaint &amp; Note Manager** is a package for managing complaints, notes, and similar entities in Laravel projects. It uses polymorphic relationships for integration with any models.

Ideal for social networks, e-commerce, and content moderation projects that require collecting and managing user complaints, reports, or note ([use cases](#use-cases)).

### Features:

[](#features)

- **Polymorphic Relationships**: Easy integration with different models.
- **Metadata**: Ability to save additional data.
- **Automatic Deletion**: Manage outdated records.
- **Customization**: Configure through configuration files and migrations.

Table of Contents
-----------------

[](#table-of-contents)

1. [Laravel Complaint &amp; Note Manager](#laravel-complaint--note-manager)
2. [Installation](#installation)
    - [Requirements ](#requirements)
    - [Step 1: Install via Composer](#step-1-install-via-composer)
    - [Step 2: Publish Configuration and Migrations](#step-2-publish-configuration-and-migrations)
3. [Configuration](#configuration)
    - [Basic Settings](#basic-settings)
    - [Customizing the Complaint Model](#customizing-the-complaint-model)
4. [Usage](#usage)
    - [Adding the Reportable Trait](#adding-the-reportable-trait)
    - [Creating a Complaint](#creating-a-complaint)
    - [Retrieving Complaints](#retrieving-complaints)
    - [Deleting a Complaint](#deleting-a-complaint)
5. [Automatic Deletion of Old Complaints](#automatic-deletion-of-old-complaints)
    - [Scheduler Configuration](#scheduler-configuration)
    - [Manual Deletion](#manual-deletion)
6. [Use cases](#use-cases)
7. [Testing](#testing)
8. [Want to Contribute?](#want-to-contribute)
9. [License](#license)

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

[](#installation)

### Requirements

[](#requirements)

- PHP ^8.0
- Laravel ^9.0, ^10.0, ^11.0

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require alyakin/reporting
```

### Step 2: Publish Configuration and Migrations

[](#step-2-publish-configuration-and-migrations)

```
php artisan vendor:publish --provider="Alyakin\Reporting\ReportingServiceProvider"
php artisan migrate
```

Ensure that your database settings are correct before running migrations.

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

[](#configuration)

After installing the module, the configuration file is available at `config/reporting.php`. If the file is missing, run the following command:

```
php artisan vendor:publish --provider="Alyakin\Reporting\ReportingServiceProvider" --tag=config
```

### Basic Settings

[](#basic-settings)

Example configuration file content:

```
return [
    'report_model' => \Alyakin\Reporting\Models\Report::class,
    'soft_delete_days' => 30,
];
```

### Customizing the Complaint Model

[](#customizing-the-complaint-model)

If you need to extend the default model, update the `report_model` parameter in the configuration:

```
'report_model' => \App\Models\CustomReport::class,
```

The model must extend `Alyakin\Reporting\Models\Report`:

```
namespace App\Models;

use Alyakin\Reporting\Models\Report;

class CustomReport extends Report
{
    // Your additional methods or fields
}
```

Usage
-----

[](#usage)

### Adding the `Reportable` Trait

[](#adding-the-reportable-trait)

Add the `Reportable` trait to any model that should support complaints:

```
use Alyakin\Reporting\Traits\Reportable;

class Post extends Model
{
    use Reportable;
}
```

### Creating a Complaint

[](#creating-a-complaint)

Use the `reports()` relationship to create a complaint:

```
$post = Post::find(1);
$user = $request->user();

$report = $post->addReport([
    'reason' => 'Спам',
    'meta' => ['severity' => 'низкий'],
], $user->id);
```

### Retrieving Complaints

[](#retrieving-complaints)

Retrieve all complaints for a model:

```
$reports = $post->reports;
```

Retrieve the related model from a complaint:

```
$post = $report->reportable;
```

### Deleting a Complaint

[](#deleting-a-complaint)

Delete a complaint using standard Eloquent methods:

```
$report->delete();
```

Automatic Deletion of Old Complaints
------------------------------------

[](#automatic-deletion-of-old-complaints)

Old complaints are deleted based on the `soft_delete_days` parameter in the configuration (default is 30 days).

### Scheduler Configuration

[](#scheduler-configuration)

Add the following line to `app/Console/Kernel.php`:

```
$schedule->command('model:prune')->daily();
```

### Manual Deletion

[](#manual-deletion)

Run the cleanup process manually:

```
php artisan model:prune
```

Use Cases
---------

[](#use-cases)

Here are five different examples of how this package can be applied across various domains:

1. **Social Networks:** Users can report posts or comments that violate guidelines...
2. **E-commerce Platforms:** Customers can flag products or sellers...
3. **Content Management Systems (CMS):** Readers can report offensive or incorrect content...
4. **Customer Support Systems:** Users can submit complaints linked to their accounts or tickets...
5. **Educational Platforms:** Students can report problems with course materials or instructors...

Testing
-------

[](#testing)

This package includes a test suite to ensure functionality works as expected. To run the tests:

```
composer test
```

### PHPUnit

[](#phpunit)

The package uses PHPUnit for feature and unit tests. You can run PHPUnit tests specifically with:

```
./vendor/bin/phpunit
```

### Static Analysis

[](#static-analysis)

We use Larastan (PHPStan for Laravel) for static code analysis (with level 9):

```
./vendor/bin/phpstan analyse
```

### Code Style

[](#code-style)

Laravel Pint is used for code style enforcement:

```
./vendor/bin/pint
```

Want to Contribute?
-------------------

[](#want-to-contribute)

This package is open for community contributions!

You can:

- Explore the [open issues](https://github.com/2177866/reporting/issues) to see what's planned
- Pick a task labeled [`good first issue`](https://github.com/2177866/reporting/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or [`help wanted`](https://github.com/2177866/reporting/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
- Suggest a new feature or improvement by opening an issue
- Fork the repository and submit a Pull Request

### Contribution Requirements

[](#contribution-requirements)

When contributing to this package, please ensure:

1. **Code Style**: All code must follow our style guidelines. Run Laravel Pint before submitting:

    ```
    ./vendor/bin/pint
    ```
2. **Static Analysis**: Code must pass Larastan level 9 analysis:

    ```
    ./vendor/bin/phpstan analyse
    ```
3. **Test Coverage**: All new features or bug fixes must include tests.
4. **Documentation**: Update the README.md and other documentation to reflect any changes in functionality.
5. **Feature Branches**: Create a feature branch for your changes and submit a pull request against the main branch.

### Current Roadmap Highlights

[](#current-roadmap-highlights)

- Add support for Laravel-style events (e.g. `ReportCreated`, `ReportDeleted`)
- Artisan command to purge old reports (`reporting:purge`)

We welcome contributions, feedback, and ideas! 😊

License
-------

[](#license)

This package is distributed under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~45 days

Total

3

Last Release

404d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.7PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eab5787b91f8e98e632f072b3f87a3c5d2f1e4c3a68dbdaaca650e022d0ae61?d=identicon)[2177866](/maintainers/2177866)

---

Top Contributors

[![2177866](https://avatars.githubusercontent.com/u/64738025?v=4)](https://github.com/2177866 "2177866 (32 commits)")

---

Tags

complaintslaravel-packagenotespolymorphic-relationshipsreportslaravelAuditreportfeedbackmoderationcomplaintsalyakin

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alyakin-reporting/health.svg)

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[jimmyjs/laravel-report-generator

Rapidly Generate Simple Pdf &amp; Excel Report on Laravel 5 (Using Barryvdh/DomPdf or Barryvdh/laravel-snappy &amp; maatwebsite/excel)

580157.4k1](/packages/jimmyjs-laravel-report-generator)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[drutiny/drutiny

This is a generic Drupal 7 and Drupal 8 site auditing and optional remediation tool.

132122.2k17](/packages/drutiny-drutiny)

PHPackages © 2026

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