承接 sharpapi/laravel-content-detect-urls 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sharpapi/laravel-content-detect-urls

Composer 安装命令:

composer require sharpapi/laravel-content-detect-urls

包简介

AI URL Detection for Laravel powered by SharpAPI.com

README 文档

README

Latest Version on Packagist Total Downloads

This package provides a Laravel integration for the SharpAPI URL Detection service. It allows you to automatically detect and extract URLs from text content, which is perfect for content moderation, data extraction, and link validation.

Installation

You can install the package via composer:

composer require sharpapi/laravel-content-detect-urls

Configuration

Publish the config file with:

php artisan vendor:publish --tag="sharpapi-content-detect-urls"

This is the contents of the published config file:

return [
    'api_key' => env('SHARP_API_KEY'),
    'base_url' => env('SHARP_API_BASE_URL', 'https://sharpapi.com/api/v1'),
    'api_job_status_polling_wait' => env('SHARP_API_JOB_STATUS_POLLING_WAIT', 180),
    'api_job_status_polling_interval' => env('SHARP_API_JOB_STATUS_POLLING_INTERVAL', 10),
    'api_job_status_use_polling_interval' => env('SHARP_API_JOB_STATUS_USE_POLLING_INTERVAL', false),
];

Make sure to set your SharpAPI key in your .env file:

SHARP_API_KEY=your-api-key

Usage

use SharpAPI\ContentDetectUrls\ContentDetectUrlsService;

$service = new ContentDetectUrlsService();

// Detect URLs in text
$detectedUrls = $service->detectUrls(
    'Check out these websites: example.com, https://github.com, and www.laravel.com/docs'
);

// $detectedUrls will contain a JSON string with the detected URLs

Parameters

  • text (string): The text content to analyze for URLs

Response Format

The response is a JSON string containing an array of detected URLs with their protocols:

[
  {
    "url": "http://example.com",
    "protocol": "http"
  },
  {
    "url": "https://github.com",
    "protocol": "https"
  },
  {
    "url": "http://www.laravel.com/docs",
    "protocol": "http"
  }
]

Features

  • Automatically detects URLs in text content
  • Works with various URL formats (with or without protocol, with or without www)
  • Identifies the protocol for each URL
  • Handles URLs with different TLDs (.com, .org, .io, etc.)
  • Useful for content moderation, data extraction, and link validation

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

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