路由从 OpenAPI 规范导入,未在规范中定义的路径访问会报错
Restful-API-Starter — Laravel 启动器模板
作者 omarfawzi
基于 Laravel 的 RESTful API 启动器,用 OpenAPI 规范驱动路由注册与请求校验。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 2
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
集成 OpenAPI PSR-7 消息校验器,按规范校验请求
安全认证依据 OpenAPI 规范执行,由 AuthenticationManager 处理
提供 Makefile 命令覆盖重建服务、合并校验规范、本地托管 Swagger UI 与运行测试
新增接口需在规范中定义 operationId 并注册到 ApiHandler::MAP
模板详细介绍
Restful-API-Starter 是一个 Laravel 启动器项目,目标是把 RESTful API 的请求结构校验交给 OpenAPI 规范处理,让开发者专注于业务逻辑的校验与实现。项目要求 PHP 8.0 及以上、MySQL 8 和 Laravel 9。
它的核心机制是:路由不再逐条手写,而是从 OpenAPI 规范导入,因此访问规范中未定义的路径会直接返回错误;安全认证同样依据规范执行,由 App\Modules\OpenApi\Services\AuthenticationManager 处理。请求校验依赖 thephpleague/openapi-psr7-validator 这一 OpenAPI PSR-7 消息校验器,规范文件放在 storage/app/schema 目录下。
使用流程上,项目通过 Makefile 提供命令:make rebuild 重建并启动服务,make bundle 合并并校验规范,make swagger-ui 在本地托管 OpenAPI 规范,make test 运行测试。新增接口时需要在规范中为操作定义 operationId,并把该 operationId 与对应的 RequestHandler 注册到 app/Modules/Api/ApiHandler.php 的 MAP 中。
限制方面,项目资料未说明其生产就绪程度、性能表现或除上述依赖外的其他能力;演示图片、字体、图标等第三方素材的许可需单独核对。
适合你的项目吗?
适用场景
- 需要以 OpenAPI 规范作为路由与请求校验唯一来源的 Laravel API 项目
- 希望把请求结构校验从业务代码中抽离,专注业务逻辑实现的团队
- 需要本地托管并查看 OpenAPI 规范文档的开发流程
- 在容器环境中通过 Makefile 统一管理构建、规范打包与测试的 API 服务
适合人群
- 使用 Laravel 并接受 OpenAPI 规范驱动路由的开发者
- 需要统一请求校验与认证规范的 API 团队
- 习惯用 Makefile 组织本地开发命令的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
环境需满足 PHP >= 8.0、MySQL 8 与 Laravel 9
- 2
运行 make rebuild 重建并启动服务
- 3
本地开发需安装 npm
- 4
在 storage/app/schema 下添加 OpenAPI 规范,并为新操作定义 operationId
- 5
把 operationId 与对应 RequestHandler 加入 app/Modules/Api/ApiHandler.php 的 MAP
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 运行环境有硬性要求:PHP 版本需不低于 8.0,数据库需 MySQL 8,框架需 Laravel 9,低于或高于这些版本可能无法正常使用。
- 本地开发需额外安装 npm(Node.js 包管理器),属于项目之外的外部工具依赖。
- 路由完全由 OpenAPI 规范决定,访问规范中未定义的路径会直接返回错误,无法绕过规范自行添加路由。
- 新增接口必须在 storage/app/schema 下补充 OpenAPI 规范,且每个操作都必须定义 operationId,否则无法接入。
- 新增的 operationId 必须与对应 RequestHandler 一起注册到 app/Modules/Api/ApiHandler.php 的 ApiHandler::MAP 中,否则请求无法被处理。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
- PHP >= 8.0 - MYSQL 8 - Laravel 9
README 原文
- Install [npm](https://nodejs.org/en/download) for local development.
README 原文
this also means that accessing any routes not specified in the open api specifications would return an error.
README 原文
Add your open api specifications (under `storage/app/schema`) and **don't** forget to define an `operationId` for your new operation.
README 原文
https://github.com/omarfawzi/Restful-API-Starter/blob/main/LICENSEhttps://github.com/omarfawzi/Restful-API-Starter/blob/main/README.mdAdd the new `operationId` and the corresponding `RequestHandler` to the `ApiHandler::MAP` (located at `app/Modules/Api/ApiHandler.php`).
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-13。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 68 / 100
- 技术栈
- Laravel
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2022-09-11
- 截图检查日期
- 2026-10-13
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Laravel。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-13
查看当时使用的来源资料
SHA-256: 150f323a1c1c8cb850d8c88131271ce40ab38eec6697a1861b60e036f8135b40
2026-10-13T06:00:01.867Z
来源文件 / 仓库[](https://github.com/omarfawzi/Restful-API-Starter/actions/workflows/main.yml) # Restful API Starter **Avoid** request schema code validation, starter which is integrated with the agnostic open api schema + validation in order to provide the best restful design for your API services, care about your business logic validation, implementation and leave the starter to take care of the rest. ### Request Life Cycle  ### Requirements - PHP >= 8.0 - MYSQL 8 - Laravel 9 ### Powered By - Open API (3.0.2) - [OpenAPI PSR-7 Message (HTTP Request/Response) Validator](https://github.com/thephpleague/openapi-psr7-validator) ### Specifications Added under `storage/app/schema` ([Live](https://omarfawzi.github.io/Restful-API-Starter/)). ### Routes Routes are imported from the open api specifications to provide a more generic way for configuring routes, this also means that accessing any routes not specified in the open api specifications would return an error. For more info check `App\Providers\RouteServiceProvider::configureRoutes` ### Security Security is done based on the specification as well and handled by the `App\Modules\OpenApi\Services\AuthenticationManager` ### Get Ready - `make rebuild` to rebuild and start services. - Install [npm](https://nodejs.org/en/download) for local development. - Add your open api specifications (under `storage/app/schema`) and **don't** forget to define an `operationId` for your new operation. - Add the new `operationId` and the corresponding `RequestHandler` to the `ApiHandler::MAP` (located at `app/Modules/Api/ApiHandler.php`). - `make bundle` to combine and validate your specs. - `make swagger-ui` to host your open api specs locally [localhost](http://localhost:8081). - `make test` to start running tests. Have a look over [Makefile](https://github.com/omarfawzi/Restful-API-Starter/blob/main/Makefile) for more options. ### Contributions Feel free to create Pull Requests.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

sage
WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and block editor support
Laravel · 启动器

wave
Wave - The Software as a Service Starter Kit, designed to help you build the SAAS of your dreams 🚀 💰
Laravel · SaaS

filament-starter
A beautiful starting point for your next TALL stack project using Filament. ⚡
Laravel · 启动器

electrik
Laravel SaaS starter kit: auth, teams, Stripe billing, and Slate 3 — Composer package for Laravel 12
Laravel · SaaS

php-saas
The everything-included starter kit for your next idea
Laravel · SaaS

filament-jetstream
A Laravel starter kit built with Filament inspired by Jetstream.
Laravel · 启动器
