serpcheap/laravel 问题修复 & 功能扩展

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

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

serpcheap/laravel

Composer 安装命令:

composer require serpcheap/laravel

包简介

Laravel integration for the serp.cheap Google SERP API — ServiceProvider, Facade, cached client, and an artisan command.

README 文档

README

Laravel integration for the serp.cheap Google Search API — real-time Google SERP data wrapped with a ServiceProvider, Facade, cached client, and an artisan command.

It's the cheapest Google Search API we know of — $0.0003 per cached search, $0.0006 fresh, no monthly minimum (~10× cheaper than SerpApi).

Wraps the serpcheap/serpcheap PHP SDK with a ServiceProvider, a SerpCheap Facade, transparent result caching, and an artisan command.

Install

composer require serpcheap/laravel

Set your API key (get one at app.serp.cheap):

SERPCHEAP_API_KEY=your-key

The provider and SerpCheap alias are auto-discovered. To customize, publish the config:

php artisan vendor:publish --tag=serpcheap-config

Usage

use SerpCheap\Laravel\Facades\SerpCheap;

$results = SerpCheap::search('best running shoes', ['gl' => 'us']);
$page    = SerpCheap::scrape('https://example.com');
$rank    = SerpCheap::rank('example.com', 'best running shoes');

Results are cached by default (keyed by query + options) so repeat calls don't spend credits. Reach the raw, uncached SDK client when you need it:

SerpCheap::client()->searchPages('best running shoes', 1, 3);

Dependency injection

use SerpCheap\Laravel\SerpCheapManager;

public function __construct(private SerpCheapManager $serp) {}

Artisan

php artisan serpcheap:search "best running shoes" --gl=us --page=1
php artisan serpcheap:search "best running shoes" --json

Configuration

Env Default Description
SERPCHEAP_API_KEY API key (required)
SERPCHEAP_BASE_URL https://api.serp.cheap API base URL
SERPCHEAP_TIMEOUT_MS 15000 Per-request timeout
SERPCHEAP_MAX_RETRIES 2 Retry count on transient errors
SERPCHEAP_CACHE true Toggle result caching
SERPCHEAP_CACHE_STORE default store Cache store to use
SERPCHEAP_CACHE_TTL 3600 Cache TTL in seconds

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-16