osd/ip-check-spam 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

osd/ip-check-spam

最新稳定版本:1.0.0

Composer 安装命令:

composer require osd/ip-check-spam

包简介

Qualify if an IP is listed as spam using AI

README 文档

README

Qualify whether an IP address is likely to be spam or abusive using AI-based analysis.

This package is framework-agnostic, designed to be used in any PHP project (Laravel, Symfony, legacy PHP, etc.) and follows a clean, DDD-inspired architecture.

It currently uses Groq AI (GPT models) to analyze IP metadata and return a structured spam risk assessment.

Installation

Install the package via Composer:

composer require osd/ip-check-spam

Features

  • AI-based IP spam risk analysis
  • Residential vs datacenter classification
  • Deterministic, structured output
  • No framework dependencies
  • No environment configuration required
  • Explicit configuration via value objects
  • Designed for clean integration into larger systems

Requirements

  • PHP ^8.1
  • ext-curl
  • A valid Groq API key

Installation

composer require osd/ip-check-spam

Basic Usage

use Osd\IpCheckSpam\Bootstrap\IpCheckSpamFactory;
use Osd\IpCheckSpam\Domain\DTO\IpSpamInput;
use Osd\IpCheckSpam\Application\Config\IpSpamConfig;

// Build the input from your own IP/domain model
$input = new IpSpamInput(
    ip: 'IP_ADDRESS',
    asn: 12345,
    isp: 'ISP_NAME',
    organization: 'ORGANIZATION_NAME',
    country: 'COUNTRY_CODE',
    city: 'CITY_NAME',
    cidr: 'CIDR_RANGE'
);

// Explicit configuration (no env dependency)
$config = new IpSpamConfig(
    apiKey: 'YOUR_GROQ_API_KEY'
);

// Create analyzer
$analyze = IpCheckSpamFactory::create($config);

// Execute analysis
$assessment = $analyze->execute($input);

// Access results
$assessment->spamScore();
$assessment->confidence();
$assessment->type();
$assessment->explanation();
$assessment->explanationEs();

Output Model

The analysis result is returned as an IpSpamAssessment value object.

Field Type Description
spamScore float Spam likelihood (0.0 – 1.0)
confidence string low, medium, high
type string user or datacenter
explanation string Technical explanation (EN)
explanationEs string Technical explanation (ES)

Architecture Overview

This package follows a clean, framework-agnostic architecture inspired by DDD (Domain-Driven Design) and Hexagonal Architecture.

Layers

  • Domain

    • Pure business concepts
    • Immutable value objects (IpSpamAssessment)
    • DTOs (IpSpamInput)
    • Contracts (interfaces)
  • Application

    • Use cases (AnalyzeIpSpamRisk)
    • Configuration objects (IpSpamConfig)
    • Orchestrates the analysis flow
  • Infrastructure

    • External AI integration (Groq / GPT models)
    • HTTP clients
    • Prompt builders
    • Response mappers
  • Bootstrap

    • Factory for assembling default implementations
    • No dependency on frameworks or containers

Key Principles

  • No framework dependency (Laravel / Symfony / etc.)
  • No environment coupling (.env is not required)
  • Explicit configuration via objects
  • Immutable domain models
  • Easy to replace AI providers or models
  • Designed for reuse across multiple projects

This makes the package suitable for:

  • Legacy PHP applications
  • Modern PHP projects
  • Microservices
  • CLI tools
  • Portfolio-grade architecture examples

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固