定制 ernestdefoe/recruiting 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ernestdefoe/recruiting

Composer 安装命令:

composer require ernestdefoe/recruiting

包简介

College football recruiting tracker for Flarum 2. Pulls live data from the College Football Data API (collegefootballdata.com) and renders a recruiting rankings page at /recruiting.

README 文档

README

Floxum Version Downloads Review License

A Flarum 2 extension that pulls live college football recruiting rankings from the College Football Data API and displays them on a dedicated /recruiting page inside your Flarum forum.

Desktop view

Features

  • Live data — recruiting rankings pulled directly from the CFBD API and cached server-side
  • Player headshots — automatically sourced from On3's football rankings page; falls back to a star-tier coloured initials avatar when no photo is available
  • Full player details — national rank, star rating, numerical rating, position, height, weight, high school, hometown, and commitment status
  • Filters — search by name / school / city, filter by position, filter by committed vs. undecided
  • Stats bar — total recruits displayed, average rating, committed count
  • Responsive grid — adapts from 4–5 columns on desktop down to 2 on mobile
Mobile view
Mobile view

Requirements

  • Flarum 2.x
  • PHP 8.3+
  • A free CFBD API key from collegefootballdata.com
  • guzzlehttp/guzzle ^7.0 (pulled in automatically via Composer)

Installation

composer require ernestdefoe/recruiting
php flarum migrate
php flarum cache:clear

Then enable the extension in Admin → Extensions.

Configuration

All settings are found in Admin → Extensions → FBSFB Recruiting.

Setting Description Default
API Key Your CFBD bearer token (required)
Recruiting Year Class year to display (e.g. 2026) Current calendar year
Team Filter Show only recruits committed to a specific team (e.g. Alabama). Leave blank for national rankings. (blank — national)
Page / Widget Title Heading shown above the widget and on /recruiting. Leave blank for "Top Recruits". (blank)
Max Recruits How many recruits to display (1–100) 25
Cache Duration Soft TTL for CFBD responses (minutes). After this expires the next request serves the cached data and dispatches a background refresh — see Caching & refresh strategy. 360 (6 hours)

How it works

  1. A forum member navigates to /recruiting (or clicks the Recruiting link in the sidebar nav).
  2. The JS frontend calls the internal API route GET /api/cfbd-recruits.
  3. The PHP controller reads your admin settings and checks Flarum's cache. If the cached payload is fresh it returns immediately. If it's past the soft TTL it dispatches a background refresh job and returns the cached (stale) data immediately — see Caching & refresh strategy.
  4. The refresh job (RefreshRecruitsJob) proxies a request to https://api.collegefootballdata.com/recruiting/players?year=…&team=…, sorts results by national ranking, transforms them into the JSON shape, and writes the new payload back to the cache envelope.
  5. Recruit records are enriched with On3 headshots (see below) and returned to the client.
  6. Player cards are rendered with national rank, stars, headshot, physical measurements, high school, hometown, and commitment pill.
  7. Client-side filters let users narrow by position, commitment status, or keyword search instantly without a second API call.

Caching & refresh strategy

The extension uses a stale-while-revalidate cache envelope so a CFBD round-trip (≤ 10 s) never blocks the user's request.

Cache shape

ernestdefoe-recruiting.<hash> → { data: [...], fetched_at: <unix ts> }
  • Hard retention: 7 days. Stale data is still served if every refresh attempt fails — better than a blank widget during a CFBD outage.
  • Soft TTL: the Cache Duration setting (default 6 hours). Determines when a request is treated as stale and triggers a background refresh.

Refresh paths

State Behaviour
Fresh cache (within soft TTL) Return cached data. No network.
Stale cache, no refresh in flight Dispatch RefreshRecruitsJob, return cached data immediately. A 90 s "refreshing" lock prevents N concurrent requests from dispatching N jobs in a stampede.
Stale cache, refresh already in flight Return cached data immediately. The in-flight job will repopulate the cache for the next visitor.
No cache at all (first request ever, or cache:clear) Inline CFBD fetch. This is the ONE request that pays the API round-trip on the request thread.

Recommended: run a queue worker

By default Flarum 2 ships with the sync queue driver, which means RefreshRecruitsJob::dispatch() runs inline in the request — defeating the point of the stale-while-revalidate pattern (one unlucky stale request per soft-TTL window still pays the CFBD cost).

For zero-wait refresh, configure a real queue driver in config.php:

'queue' => [
    'driver' => 'database',     // or 'redis', 'sqs', etc.
],

…then run a queue worker (typically under supervisor / systemd):

php flarum queue:work --tries=3 --timeout=60

With a real driver the dispatch returns in <1 ms and the worker handles the CFBD fetch in the background. Every request — even the first one after the soft TTL expires — gets cached data instantly.

Player headshots

Headshots are sourced from On3, which maintains photos for thousands of current and historical high-school recruits.

How the image lookup works

On3's football rankings page (on3.com/rivals/rankings/player/football/{year}/) is fully server-rendered HTML containing 150+ ranked recruits, each with a profile link and headshot image URL embedded directly in the markup.

On the first API call after the cache is empty the extension:

  1. Fetches the On3 rankings page for the configured class year (one HTTP request).
  2. Parses the HTML to build a name → image URL map using positional matching between profile hrefs (/rivals/jared-curtis-159433/) and on3static.com image paths.
  3. Caches the map for 24 hours — subsequent requests read from cache with zero external HTTP calls.
  4. Matches each CFBD recruit to the map by normalised name slug (e.g. "Jared Curtis""jared-curtis").

Fallback avatars

When no On3 photo is available the card shows a coloured initials avatar whose background is coded by star rating:

Stars Colour
★★★★★ Gold
★★★★ Blue
★★★ Green
★★ / unrated Slate

Player card data

Each card displays:

  • National ranking (#1, #2, …)
  • Star rating (★★★★★) and numerical rating (e.g. 0.9991)
  • Headshot — sourced from On3; coloured initials avatar as fallback
  • Name and position (QB, WR, CB, OT, DE, …)
  • Height · Weight (e.g. 6'3" · 215 lbs)
  • High school name
  • Hometown (City, State)
  • Commitment pill✔ Georgia (green) or ○ Undecided (grey)

Data sources

Data Source
Rankings, ratings, recruit details College Football Data API
Player headshots On3 rankings page

CFBD provides a free API key with generous rate limits. The extension caches all external responses to minimise outbound requests.

Support

Questions, bug reports, and feature requests:

License

MIT

ernestdefoe/recruiting 适用场景与选型建议

ernestdefoe/recruiting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「flarum」 「recruiting」 「college football」 「gridiron」 「cfbd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ernestdefoe/recruiting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ernestdefoe/recruiting 我们能提供哪些服务?
定制开发 / 二次开发

基于 ernestdefoe/recruiting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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