searsandrew/series-wiki
Composer 安装命令:
composer require searsandrew/series-wiki
包简介
Series-agnostic wiki backend toolkit for Laravel (spoiler gates, templates, timelines, link suggestions).
README 文档
README
SeriesWiki is a series-agnostic, spoiler-safe wiki backend toolkit for Laravel. It provides a block-based content model with:
- Spoiler gating (work/chapter gates) with safe/full block bodies
- Timeline filtering (year/era slices) at the block level
- Variants (faction/perspective switching) driven by data tables (no hardcoding)
- Templates that seed entries with required blocks by entry type (e.g. planet/species/ship)
- Internal link suggestions via a crawler + review/apply workflow
- Search API backed by crawler snapshots (
safeandfullmodes) - Validation for entry meta + block payloads (extensible via config)
This package does not include a UI/editor. Your application provides the admin/editor experience.
Install
composer require searsandrew/series-wiki
Publish config + migrations:
php artisan vendor:publish --tag=series-wiki-config php artisan vendor:publish --tag=series-wiki-migrations php artisan migrate
Core Concepts
- Series: A wiki universe / series namespace (e.g. “Stellar Empire”)
- Entry: A page/subject (ship/species/planet/event/etc.)
- Block: The unit of content for an entry (text/image/chart/map/etc.)
- Gate: A spoiler threshold (work + chapter position)
- TimeSlice: A year/era/range for timeline filtering
- Variant: An alternate view of an entry (often faction-based)
- Template: Seeds an entry with a standard set of blocks (by entry type)
Rendering (Spoilers + Timeline + Variants)
Render blocks for an entry using a viewer context:
use Searsandrew\SeriesWiki\Services\EntryRenderer; use Searsandrew\SeriesWiki\Services\Timeline\YearRange; $renderer = app(EntryRenderer::class); $blocks = $renderer->renderWithContext( $entry, auth()->user(), // or null for guest new YearRange(4250, 4250), // or null for no time filtering 'republic' // variant_key (optional) );
Each item includes:
- display.text (for text blocks)
- display.payload (for non-text blocks)
- is_locked / locked_mode
Templates: create entry scaffolds by type
Create a template with entry_type = 'planet', then use your app to create entries of type planet.
The package will resolve the default template by type and seed the required blocks.
Search API (Safe vs Full)
Search uses crawler snapshots. Query in safe mode for spoiler-safe results (recommended for public):
use Searsandrew\SeriesWiki\Services\Search\SearchService; $results = app(SearchService::class)->search($series, 'Type 88', [ 'mode' => 'safe', // 'safe' or 'full' 'type' => 'ship', // optional entry type filter 'limit' => 20, ]);
Each result includes: entry, score, snippet, mode
Crawler: Link Suggestions + Snapshots
Generate snapshots and link suggestions:
php artisan series-wiki:crawl --series=stellar-empire
The crawler creates:
- entry snapshots in
sw_entry_snapshots(bothsafeandfullmodes) - suggestions in
sw_link_suggestions(new|accepted|dismissed)
Applying suggestions
Your app can review suggestions and apply them to blocks using:
Searsandrew\SeriesWiki\Services\Crawler\LinkSuggestionWorkflow
It supports accept/dismiss and applying a suggestion to markdown content.
URL generation
Markdown URL generation is configurable:
// config/series-wiki.php 'links' => [ 'url_generator' => function ($entry) { return '/wiki/' . $entry->slug; }, ],
Validation
Validation is extensible via config:
entries.types.{type}.rules/defaults/fieldsblocks.types.{type}.rules/defaults/fields
Use:
Searsandrew\SeriesWiki\Services\Entries\EntryValidatorSearsandrew\SeriesWiki\Services\Blocks\BlockValidator
Tests
./vendor/bin/pest
License
MIT
searsandrew/series-wiki 适用场景与选型建议
searsandrew/series-wiki 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 searsandrew/series-wiki 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 searsandrew/series-wiki 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-26