PHPackages                             palpalani/laravel-spamassassin-score - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. palpalani/laravel-spamassassin-score

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

palpalani/laravel-spamassassin-score
====================================

Check the spam score of emails before sending them.

1.1.0(6mo ago)42.9k2[2 PRs](https://github.com/palpalani/laravel-spamassassin-score/pulls)MITPHPPHP ^8.3CI passing

Since Feb 26Pushed 1mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (12)Used By (0)

Laravel SpamAssassin Score
==========================

[](#laravel-spamassassin-score)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7aafaca326a84056a7874f862dba5d1f110afc7bccd47b153f4683a94948a775/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/palpalani/laravel-spamassassin-score)[![Total Downloads](https://camo.githubusercontent.com/a189258ff01ff9e6f061f8f12c47779699365637558275dc440baa8df92ebe3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/palpalani/laravel-spamassassin-score)[![License](https://camo.githubusercontent.com/7c332fb62fbbb1f1471866df1e3361d339cee78c02084d48a4448bc16fd73f5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/palpalani/laravel-spamassassin-score)

[![GitHub Tests](https://camo.githubusercontent.com/5483da35826dec8f5c78ecba934990356ad53277061572150076d81b5601c3a8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/palpalani/laravel-spamassassin-score/actions/workflows/run-tests.yml)[![Code Style](https://camo.githubusercontent.com/1b68ff9fedb0bdea14c023bab24d47f6cee63be607b511ccd85b4fa5fc214609/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652f70696e742e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/palpalani/laravel-spamassassin-score/actions/workflows/pint.yml)[![PHPStan](https://camo.githubusercontent.com/9e9a2f2af0447ffda864eb21647b79e3bd4b5833cb59e795233db356812cdf16/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70616c70616c616e692f6c61726176656c2d7370616d617373617373696e2d73636f72652f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/palpalani/laravel-spamassassin-score/actions/workflows/phpstan.yml)

[![PHP Version Support](https://camo.githubusercontent.com/991a34c310fff7199a95b52041da44e0f5543b8195e93a82d69bb9c478ac6e97/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382e332d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel Version Support](https://camo.githubusercontent.com/b77015737266d2e1bd81e85d805208fa58c2fb7d945b7115c72705798af8a9dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531312e3025323025374325323025354531322e302d4646324432302e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

A Laravel package to check the spam score of email contents before sending them using the SpamAssassin filter API.

Features
--------

[](#features)

- ✅ Check email spam scores using SpamAssassin API
- ✅ Simple and intuitive API
- ✅ Facade support for easy access
- ✅ Fully configurable
- ✅ Supports both "short" and "long" report formats
- ✅ Works with Laravel 11 and 12
- ✅ Well tested
- ✅ PHP 8.3+ support

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

[](#requirements)

- PHP &gt;= 8.3
- Laravel ^11.0 | ^12.0

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

[](#installation)

You can install the package via Composer:

```
composer require palpalani/laravel-spamassassin-score
```

The package will automatically register its service provider and facade.

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

[](#configuration)

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-spamassassin-score-config"
```

This is the contents of the published config file:

```
return [
    'api' => 'https://spamcheck.postmarkapp.com/filter',

    // Default "long". Must either be "long" for a full report of processing rules, or "short" for a score request.
    'option' => 'long'
];
```

### Configuration Options

[](#configuration-options)

- **`api`**: The SpamAssassin API endpoint URL
- **`option`**: The report format - either `"long"` for a full report of processing rules, or `"short"` for a score request only

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use palPalani\SpamassassinScore\Facades\SpamassassinScore;

// Get spam score with default configuration
$result = SpamassassinScore::getScore($emailContent);

// The result will contain:
// - 'score': The spam score
// - 'success': Whether the check was successful
// Additional fields when using 'long' option format
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use palPalani\SpamassassinScore\SpamassassinScore;

class EmailController extends Controller
{
    public function __construct(
        private SpamassassinScore $spamassassinScore
    ) {}

    public function checkEmail(Request $request)
    {
        $result = $this->spamassassinScore->getScore($request->input('email'));

        if ($result['score'] > 5.0) {
            return response()->json(['message' => 'Email may be spam'], 400);
        }

        // Proceed with sending email
    }
}
```

### Using Direct Instantiation

[](#using-direct-instantiation)

```
use palPalani\SpamassassinScore\SpamassassinScore;

$spamassassinScore = new SpamassassinScore();
$result = $spamassassinScore->getScore($emailContent);

// Access the score
$score = $result['score'] ?? null;
```

### Example Response

[](#example-response)

When using the default "long" option, the response includes:

```
[
    'success' => true,
    'score' => 2.5,
    'rules' => [
        // Full list of rules that matched
    ],
    'description' => '...'
]
```

When using "short" option, the response is:

```
[
    'success' => true,
    'score' => 2.5
]
```

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

For test coverage:

```
composer test-coverage
```

Code Quality Tools
------------------

[](#code-quality-tools)

This package uses several code quality tools:

- **[PHPUnit](https://phpunit.de/)** - Testing framework
- **[Pest](https://pestphp.com/)** - Testing framework (alternative)
- **[Laravel Pint](https://laravel.com/docs/pint)** - Code style fixing (powered by PHP CS Fixer)
- **[PHPStan](https://phpstan.org/)** - Static analysis
- **[Larastan](https://github.com/larastan/larastan)** - Laravel-specific static analysis (PHPStan extension)

Run static analysis:

```
composer analyse  # PHPStan
```

Run code formatting:

```
composer format  # Laravel Pint
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.

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

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/palpalani/laravel-spamassassin-score/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance79

Regular maintenance activity

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 90.8% 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 ~190 days

Recently: every ~321 days

Total

10

Last Release

197d ago

Major Versions

0.2.7 → 1.1.02025-11-03

PHP version history (2 changes)0.1.0PHP ^7.4|^8.0

1.1.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/716695?v=4)[Palaniappan P](/maintainers/palpalani)[@palpalani](https://github.com/palpalani)

---

Top Contributors

[![palpalani](https://avatars.githubusercontent.com/u/716695?v=4)](https://github.com/palpalani "palpalani (69 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

phplaravelpackageemailpalpalanispamassassinlaravel-spamassassin-scorespam-scorespam-check

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/palpalani-laravel-spamassassin-score/health.svg)

```
[![Health](https://phpackages.com/badges/palpalani-laravel-spamassassin-score/health.svg)](https://phpackages.com/packages/palpalani-laravel-spamassassin-score)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[martian/spammailchecker

A laravel package that protect users from entering non-existing/spam email addresses.

422.0k](/packages/martian-spammailchecker)[ferdous/laravel-otp-validate

Laravel package for OTP validation with built-in features like retry and resend mechanism. Built in max retry and max resend blocking. OTP/Security Code can be send over SMS or Email of your choice with user-defined template.

7124.4k](/packages/ferdous-laravel-otp-validate)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

14109.2k](/packages/hafael-azure-mailer-driver)

PHPackages © 2026

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