当前位置: 首页 > Skill >

Laravel Docs Reader

Laravel Docs Reader

1.0.0 2026.11.27 浏览:300
获取Skill文件查看使用说明
作者:陈言许可证:
本文目录展开

Laravel Docs Reader — Skill Specification

Overview

Skill Name: Laravel Docs Reader Type: Development Reference Skill Target: OpenClaw Agent and Laravel developers Version: 1.0.0

Core Objectives

  1. Provide instant, accurate access to official Laravel documentation during coding
  2. Auto-detect the local Laravel version and serve the correct docs
  3. Generate standard Laravel code that conforms to Laravel best practices and PSR-12
  4. Highlight version differences across Laravel 10 / 11 / 12
  5. Keep references up to date via GitHub Actions auto-PR

Version Support

Version Status Notes
Laravel 12 ✅ Default Latest stable
Laravel 11 ✅ Supported Full reference
Laravel 10 ✅ Supported Full reference

Version Detection (Auto-Switch)

When the agent runs on a project, it auto-detects Laravel version:

  1. composer.json → "laravel/framework": "^12.x"
  2. artisan --version
  3. vendor/laravel/framework/src/Illuminate/Foundation/Application.php → VERSION constant

Detection path: references/version-detection.md

CLI Tool

php laradoc.php <command> [args]
Command Args Description
search <query> Natural language search (with Package Search cross-link)
version [path] Detect local Laravel version
current — Show default version
config <file> Config reference (database/cache/mail/...)
facade <name> Facade method signatures
artisan <cmd> Artisan command help
diff <feature> Version diff (auth/routing/middleware/exception)
generate <type> <name> Code skeleton (controller/model/job/middleware)
lang <query> Blade directive lookup
psr [topic] PSR-12 quick reference (full/arrays/naming/methods)
cache — Show local cache status
update — Force-refresh cache from GitHub
subscribe — Show subscription / auto-update status

Search Coverage

Category Topics
Routing Basic routes, route groups, resource routes, named routes, middleware
Controllers CRUD, REST, API, single-action, dependency injection
Models Eloquent, relationships (12 types), mutators, scopes
Migrations Schema builder, foreign keys, indexes, modifiers
Validation Form requests, inline validation, custom rules
Auth Breeze, Sanctum, Gates, Policies, JWT
Queues Jobs, dispatching, failed job handling, Laravel Horizon
Cache Store API, tags, atomic locks
Mail Markdown, attachments, queuing
Notifications Multi-channel, database notifications
Testing Feature tests, unit tests, Pest, factories
Events Listeners, broadcasting, queueable events
Storage Local/S3/FTP, temporary URLs, uploads
Scheduling Cron, recurring jobs, prevention of overlap
Service Container Binding, singletons, contextual binding
Facades All 30+ facades with method signatures
Broadcasting Private/public channels, presence channels
Configuration database, cache, mail, queue, auth, session

Code Generation

The generate command outputs standard Laravel code for:

  • controller — RESTful API controller
  • model — Eloquent model with fillable/casts/relationships
  • job — Queueable job with failed handler
  • middleware — HTTP middleware
  • request — Form Request validation
  • notification — Multi-channel notification
  • factory — Model factory for testing

All output follows PSR-12 and Laravel conventions.

Version Diff

Feature Laravel 10 Laravel 11 Laravel 12
Auth scaffolding laravel new --auth Breeze Breeze (minimal)
Middleware registration Kernel.php bootstrap/app.php bootstrap/app.php
Route registration RouteServiceProvider bootstrap/app.php bootstrap/app.php
Exception handling app/Exceptions/Handler bootstrap/app.php bootstrap/app.php
Cycle tasks app/Console/Kernel.php routes/console.php routes/console.php
Broadcast channels routes/channels.php routes/channels.php routes/channels.php

Auto-Update Mechanism

A GitHub Actions workflow runs weekly to:

  1. Fetch latest laravel/framework version from Packagist
  2. Compare against the skill's default version
  3. If new version detected → auto-create a PR with updated references
.github/workflows/update-docs.yml
  ├── Schedule: Every Sunday 00:00 UTC
  └── Creates PR: updates SKILL.md + version-detection.md

Anyone using this skill can review the auto-PR and merge after verification.

File Structure

laravel-docs-reader/
├── SKILL.md                          # This file
├── README.md                          # English (default)
├── README.zh-CN.md                    # Chinese
├── .github/
│   └── workflows/
│       └── update-docs.yml            # Auto-update PR workflow
├── .cache/                          # Local doc cache (auto-created)
├── references/
│   ├── version-detection.md           # Version detection logic
│   ├── version-diff.md                # Version diff table (10/11/12)
│   ├── psr-12.md                    # PSR-12 quick reference
│   ├── api-index.md                  # Full API index
│   ├── artisan-commands.md           # All artisan commands
│   ├── facades.md                   # Facade method signatures
│   ├── blade-directives.md           # All Blade directives
│   ├── config-ref.md               # Config file reference
│   └── examples/
│       ├── controller.md
│       ├── model.md
│       ├── migration.md
│       ├── middleware.md
│       ├── queue-job.md
│       ├── notification.md
│       └── testing.md
└── scripts/
    └── laradoc.php                  # CLI tool (14 commands)

PSR-12 Quick Reference

Built-in PSR-12 standard reference — no external formatter needed:

php laradoc.php psr                  # Full PSR-12 table (rules + examples)
php laradoc.php psr arrays          # Arrays rule
php laradoc.php psr naming          # Naming conventions (class/method/var/const)
php laradoc.php psr methods         # Visibility + method rules
php laradoc.php psr namespace       # use statements
php laradoc.php psr operators       # Operator spacing

Topics: arrays, naming, methods, control, namespace, operators

Local Cache (Offline Mode)

The skill stores docs in .cache/ for fast, offline access:

php laradoc.php cache  # Show cache status, size, age, offline availability
php laradoc.php update  # Force-refresh from GitHub

Cache is created automatically on first search. All bundled reference files work without internet.

Auto-Update & Subscription

GitHub Actions runs weekly (Sunday 00:00 UTC):

  • Detects new laravel/framework version from Packagist
  • Auto-creates PR updating SKILL.md, version-detection.md, version-diff.md
  • User reviews PR → merges when ready
php laradoc.php subscribe  # Show current subscription / update status

Laravel Package Search Cross-Link

After every search result, the agent suggests laravel-package-search for third-party package discovery.

Usage in OpenClaw

When the agent needs to write Laravel code:

  1. Auto-detect project Laravel version
  2. Map the request to the correct doc section
  3. Return:
    • Official documentation summary
    • Code example (PSR-12, Laravel best practice)
    • Version differences (if applicable)
    • Notes / caveats

Evaluation Criteria

Each doc entry is rated on:

Criterion Description
Accuracy Matches official Laravel docs exactly
Completeness Covers all common use cases
Freshness Updated for latest Laravel version
Code Quality PSR-12 compliant, idiomatic Laravel
Version Coverage Covers 10 / 11 / 12 differences

Publishing

clawhub login --token <TOKEN>
clawhub publish laravel-docs-reader

Or submit at https://clawhub.com

相关文章

更多
小型项目到大型系统:不同规模下怎么选择最合适的PHP框架

根据项目规模选择合适的PHP框架是提升开发效率的关键。小型项目推荐Laravel或Symfony,凭借丰富功能和文档支持实现快速迭代;中型项目可选ThinkPHP或Yii2,在性能与功能间取得平衡并处理复杂业务;大型高并发系统则应选用基于协程的Swoole或Hyperf,以构建高性能实时应用及分布式微服务架构。

2025.08.11 904
主流轻量级PHP框架盘点:Slim、Lumen与Mezzio特点对比

选择轻量级 PHP 框架时,优先根据项目规模决定:微服务或 API 选 Slim , Laravel 生态依赖选 Lumen ,严格遵循 PSR 标准且需中间件灵活性选 Mezzio 。核心差异在于路由机制、中间件实现方式及依赖注入容器的集成深度。

2026.03.18 876
Laravel中间件三种类型详解:全局、路由与中间件组

Laravel中的中间件分为全局中间件($middleware)、路由中间件($routeMiddleware)和中间件组($middlewareGroups)。全局中间件对每一次请求都会执行,适用于统计请求次数等通用处理;路由中间件需在定义路由时显式引用,适合个别请求的特殊逻辑;中间件组则将多个中间件打包,如将web和api请求分离,简化了多中间件的调用流程。

2026.04.13 864
PHP主流框架对比:Laravel、Symfony与ThinkPHP核心机制解析

本文对比 PHP 三大主流框架 Laravel、Symfony 与 ThinkPHP 的核心架构差异。Laravel 凭借 Eloquent ORM 与服务容器提升开发效率;Symfony 以组件化架构和声明式 DI 配置保障企业级稳定性;ThinkPHP 则通过简洁的路由匹配与中间件机制适应国内快速开发需求。文章深入解析各框架在依赖注入、路由规则及性能优化方面的具体实现,为项目选型提供技术依据。

2026.10.13 771
Laravel vs Symfony vs ThinkPHP:PHP主流框架深度对比与选型建议

选型时先明确项目规模与团队技术栈:大型微服务或长期维护选 Symfony ,追求开发速度与生态完整选 Laravel ,中小型快速交付或国内托管环境选 ThinkPHP 。核心判断依据是组件复用能力、路由性能及社区支持度。

2026.05.26 688
Laravel自定义验证错误输出格式的方法

在Laravel框架中,通过创建表单请求类(如PostUpdateRequest)并重写messages方法,可以自定义数据验证失败时的错误返回内容。默认情况下,json_encode输出的中文可能显示为Unicode编码,通过在第二个参数添加JSON_UNESCAPED_UNICODE标志,可确保返回的JSON字符串中中文正常显示,从而提升API接口的可读性。

2026.07.11 671
Skill 文件
  • SKILL.md
    • Laravel Docs Reader — Skill Specification
    • Overview
    • Core Objectives
    • Version Support
    • Version Detection (Auto-Switch)
    • CLI Tool
    • Search Coverage
    • Code Generation
    • Version Diff
    • Auto-Update Mechanism
    • File Structure
    • PSR-12 Quick Reference
    • Local Cache (Offline Mode)
    • Auto-Update & Subscription
    • Laravel Package Search Cross-Link
    • Usage in OpenClaw
    • Evaluation Criteria
    • Publishing
  • 项目或源文件

相关 Skill

更多
compound-eng-php-laravel compound-eng-php-laravel 整理现代 PHP 与 Laravel 的类型、依赖注入、Eloquent 查询和后台任务实践。 来源说明涉及 PHP 8.4 与现代 Laravel;旧项目不能直接复制新语法。
Laravel Laravel 检查 Laravel Eloquent 的 N+1 查询、关联预加载,以及队列序列化与重试陷阱。 已有 Laravel 项目;先读取 composer.lock 确认框架和 PHP 版本。
laravel-specialist laravel-specialist 围绕 Laravel 模型关系、队列、容器和应用分层制定实现与验证步骤。 来源技能面向 Laravel 10+;实际语法与组件版本先按项目依赖核对。
Laravel Package Search Laravel Package Search 通过 Packagist API 实时搜索 Laravel 包,支持本地缓存、22 种场景、质量评分以及与 laravel-docs-reader 交叉引用实现离线查阅
thinkphp8手册 thinkphp8手册 按 ThinkPHP 8 的路由、模型、验证和视图机制定位项目实现方式。 仅面向 ThinkPHP 8;需要可访问的对应版本手册内容或项目源码。