jooservices/xflickr-crawler 问题修复 & 功能扩展

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

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

jooservices/xflickr-crawler

Composer 安装命令:

composer require jooservices/xflickr-crawler

包简介

Standalone Laravel package for queued Flickr crawling with rate limiting and MySQL persistence.

README 文档

README

Standalone Laravel 12 package for queued Flickr crawling with MySQL persistence, per-connection API rate limiting, and API call auditing.

Requirements

  • PHP 8.5+
  • Laravel 12
  • MySQL
  • Redis (queues + rate limiting)
  • Horizon or another queue worker (recommended)

Installation

composer require jooservices/xflickr-crawler
composer require jooservices/laravel-config

Publish config (optional):

php artisan vendor:publish --tag=xflickr-crawler-config
php artisan vendor:publish --tag=xflickr-crawler-host-integration

Run migrations:

php artisan migrate

Host app checklist: docs/01-getting-started/host-app-integration.md — shared Redis, Horizon, scheduler, and connection_key strategy.

Configuration

Register Flickr app profiles in jooservices/laravel-config (see docs/01-getting-started/app-profiles.md):

use JOOservices\LaravelConfig\Facades\Config;

Config::set('xflickr_app.main', [
    'apiKey' => 'your-key',
    'apiSecret' => 'your-secret',
    'label' => 'Production',
], 'json');

Host .env (shared with app queue and Horizon):

QUEUE_CONNECTION=redis
CACHE_STORE=redis

XFLICKR_DEFAULT_APP_PROFILE=main
XFLICKR_QUEUE=xflickr
XFLICKR_MAX_REQUESTS_PER_HOUR=3300

Runtime overrides (via jooservices/laravel-config):

  • xflickr.max_requests_per_hour — per connection_key, not per subject NSID
  • xflickr.global_pause
  • xflickr.dispatch_limit
  • xflickr.default_app_profile

Usage

The package does not perform OAuth. Pass a stable connection_key (rate-limit scope), a JSON token payload, and the Flickr app profile:

use JOOservices\XFlickrCrawler\Facades\FlickrService;

$connectionKey = 'user-42';
$token = json_encode([
    'oauthToken' => '...',
    'oauthTokenSecret' => '...',
    'userNsid' => '12037949629@N01',
]);

$conn = FlickrService::connection($connectionKey, $token, appProfile: 'main');

$run = $conn->contacts();
$run = $conn->photos('contact-nsid');
$run = $conn->photosets('contact-nsid');
$run = $conn->galleries('contact-nsid');

Each method returns a CrawlRun immediately. Work runs asynchronously on the xflickr queue via the host’s shared Horizon workers.

Scheduler

// routes/console.php
Schedule::command('xflickr:dispatch')->everyMinute();

Horizon

Add the xflickr queue to a Horizon supervisor in the host app:

'queue' => ['default', 'xflickr'],

Or use the published stub: stubs/xflickr-horizon-supervisor.php.

Rate limiter state

$state = FlickrService::limiterState('user-42');
// max_requests_per_hour, requests_used, requests_remaining, ...

Tables

Package-owned tables use the xflickr_* prefix: connections, contacts, photos, photosets, galleries, pivots, crawl runs/targets, and API logs.

Development

composer install
composer check      # lint + test
composer ci         # lint + test with coverage (CI)

Documentation

Audience Start here
Install & config docs/README.md
Host app + shared Horizon docs/01-getting-started/host-app-integration.md
App profiles docs/01-getting-started/app-profiles.md
Architecture docs/00-architecture/overview.md
Contributors CONTRIBUTING.md · docs/04-development/03-ci-cd.md
AI agents AGENTS.md · ai/README.md

License

MIT — see LICENSE.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固