Skip to content

Commit d562a69

Browse files
authored
Merge pull request #18 from diego-ninja/feature/improved_score_calculation
Feature/improved score calculation
2 parents 3fe4367 + 74f4c67 commit d562a69

File tree

177 files changed

+11762
-1624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+11762
-1624
lines changed

.github/workflows/code-style.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
pint:
11+
runs-on: ubuntu-latest
12+
name: Laravel Pint
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.4
22+
extensions: dom, curl, libxml, mbstring, zip
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer update --prefer-stable --prefer-dist --no-interaction
27+
28+
- name: Check code style
29+
run: composer run cs:check

.github/workflows/pest.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/phpstan.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/pint.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/security.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Security Audit
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
security-audit:
11+
runs-on: ubuntu-latest
12+
name: Security Audit
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.4'
22+
extensions: mbstring, dom, fileinfo
23+
24+
- name: Cache Composer packages
25+
uses: actions/cache@v4
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-8.4-composer-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-8.4-composer-
31+
32+
- name: Install dependencies
33+
run: composer install --prefer-dist --no-progress --no-suggest
34+
35+
- name: Security audit
36+
run: composer audit
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Static Analysis
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
name: PHPStan
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.4
22+
extensions: dom, curl, libxml, mbstring, zip
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer update --prefer-stable --prefer-dist --no-interaction
27+
28+
- name: Run PHPStan
29+
run: composer run analyse

.github/workflows/tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Pest Tests
2+
on:
3+
push:
4+
branches: [ main, develop ]
5+
pull_request:
6+
branches: [ main, develop ]
7+
8+
jobs:
9+
tests:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
php-version: ['8.3', '8.4']
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php-version }}
23+
extensions: mbstring, dom, fileinfo, mysql, redis
24+
coverage: xdebug
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate --strict
28+
29+
- name: Cache Composer packages
30+
id: composer-cache
31+
uses: actions/cache@v4
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
37+
38+
- name: Install dependencies
39+
run: composer install --prefer-dist --no-progress --no-suggest
40+
41+
- name: Run PEST tests
42+
run: composer run test
43+
44+
- name: Run PEST with coverage
45+
if: matrix.php-version == '8.4'
46+
run: composer run test:coverage-clover
47+
48+
- name: Upload coverage reports to Coveralls
49+
if: matrix.php-version == '8.4'
50+
uses: coverallsapp/github-action@v2
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
file: ./coverage/clover.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.lock
66
/.phpunit.result.cache
77
/tester.php
88
/node_modules
9+
/coverage-report/

README.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@
44
<img src="./.github/assets/logo.png" alt="Sentinel Logo"/>
55
</p>
66

7-
[![Laravel Package](https://img.shields.io/badge/Laravel%2010+%20Package-red?logo=laravel&logoColor=white)](https://www.laravel.com)
8-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/diego-ninja/sentinel.svg?style=flat&color=blue)](https://packagist.org/packages/diego-ninja/sentinel)
9-
[![Total Downloads](https://img.shields.io/packagist/dt/diego-ninja/sentinel.svg?style=flat&color=blue)](https://packagist.org/packages/diego-ninja/sentinel)
10-
![PHP Version](https://img.shields.io/packagist/php-v/diego-ninja/sentinel.svg?style=flat&color=blue)
11-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
12-
![GitHub last commit](https://img.shields.io/github/last-commit/diego-ninja/sentinel?color=blue)
13-
[![PHPStan Level](https://img.shields.io/badge/phpstan-level%2010-blue?logo=php)]()
7+
[![Laravel Package](https://img.shields.io/badge/Laravel%2010+%20Package-red?logo=laravel&logoColor=white&style=flat-square)](https://www.laravel.com)
8+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/diego-ninja/sentinel.svg?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)](https://packagist.org/packages/diego-ninja/sentinel)
9+
[![Total Downloads](https://img.shields.io/packagist/dt/diego-ninja/sentinel.svg?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)](https://packagist.org/packages/diego-ninja/sentinel)
10+
![PHP Version](https://img.shields.io/packagist/php-v/diego-ninja/sentinel.svg?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)
11+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)](https://opensource.org/licenses/MIT)
12+
![GitHub last commit](https://img.shields.io/github/last-commit/diego-ninja/sentinel?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)
13+
[![wakatime](https://wakatime.com/badge/user/bd65f055-c9f3-4f73-92aa-3c9810f70cc3/project/7b950600-2e9e-4660-906a-e8f65f555778.svg?style=flat-square&color=blue&logoColor=%23949ca4&labelColor=%233f4750)](https://wakatime.com/badge/user/bd65f055-c9f3-4f73-92aa-3c9810f70cc3/project/7b950600-2e9e-4660-906a-e8f65f555778)
1414

15-
# Introduction
15+
[![Tests](https://img.shields.io/github/actions/workflow/status/diego-ninja/sentinel/tests.yml?branch=main&style=flat-square&logo=github&label=Pest%20Tests&logoColor=%23949ca4&labelColor=%233f4750)]()
16+
[![Static Analysis](https://img.shields.io/github/actions/workflow/status/diego-ninja/sentinel/static-analysis.yml?branch=main&style=flat-square&logo=github&label=PHPStan%2010&logoColor=%23949ca4&labelColor=%233f4750)]()
17+
[![Code Style](https://img.shields.io/github/actions/workflow/status/diego-ninja/sentinel/code-style.yml?branch=main&style=flat-square&logo=github&label=Pint%3A%20PER&logoColor=%23949ca4&labelColor=%233f4750)]()
18+
[![Coveralls](https://img.shields.io/coverallsCoverage/github/diego-ninja/sentinel?branch=main&style=flat-square&logo=coveralls&logoColor=%23949ca4&labelColor=%233f4750&link=https%3A%2F%2Fcoveralls.io%2Fgithub%2Fdiego-ninja%2Fgranite)]()
1619

17-
A powerful and flexible content analysis package for Laravel 10+ applications. Analyze and filter offensive content using multiple services, local dictionaries, and advanced detection strategies.
20+
## 🚀 Introduction
1821

19-
This documentation has been generated almost in its entirety using 🦠 [Claude 3.5 Sonnet](https://claude.ai/) based on source code analysis. Some sections may be incomplete, outdated or may contain documentation for planned or not-released features. For the most accurate information, please refer to the source code or open an issue on the package repository.
22+
Sentinel is an advanced, flexible, and powerful content analysis package for Laravel applications. It provides comprehensive protection against offensive content through multiple detection strategies, context-aware analysis, and multilingual support.
23+
24+
This documentation has been generated almost in its entirety using 🦠 [Claude 3.5 Haiku](https://claude.ai/) based on source code analysis. Some sections may be incomplete, outdated or may contain documentation for planned or not-released features. For the most accurate information, please refer to the source code or open an issue on the package repository.
2025

2126
## ❤️ Features
2227

2328
- Multiple service providers support:
2429
- Local dictionary-based analysis
25-
- [PurgoMalum](https://www.purgomalum.com/)
2630
- [Tisane AI](https://tisane.ai/)
2731
- [Prism LLM](https://prism.echolabs.dev/) (with support for multiple LLMs)
2832
- [Azure AI](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/content-safety/)
@@ -34,6 +38,11 @@ This documentation has been generated almost in its entirety using 🦠 [Claude
3438
- Variation detection for obfuscated content
3539
- Repeated character detection
3640
- Levenshtein distance matching
41+
- Alphanumeric variation detection
42+
- Phonetic matching
43+
- Zero-width character detection
44+
- Reversed word detection
45+
3746
- Rich analysis results:
3847
- Sentiment analysis
3948
- Content categorization

composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
"laravel/octane": "^2.6",
4242
"wulfheart/laravel-actions-ide-helper": "^0.8.0"
4343
},
44+
"scripts": {
45+
"test": "pest",
46+
"test:unit": "pest --testsuite=Unit",
47+
"test:coverage": "pest --coverage-clover coverage/clover.xml --coverage-html coverage/html --coverage-text coverage/coverage.txt",
48+
"test:coverage-clover": "pest --coverage-clover coverage/clover.xml",
49+
"analyse": "phpstan analyse",
50+
"cs:check": "pint --test src tests",
51+
"cs:fix": "pint src tests"
52+
},
4453
"autoload": {
4554
"psr-4": {
4655
"Ninja\\Sentinel\\": "src/"

0 commit comments

Comments
 (0)