foryoufeng/laravel-doc
Composer 安装命令:
composer require foryoufeng/laravel-doc
包简介
A tool for display docs or api docs to others
README 文档
README
中文文档
⛵laravel-doc is doc generator for laravel which can help you write document by markdown and you can access it by web
Requirements
- PHP >= 7.0.0
- Laravel >= 5
Installation
Via Composer
composer require foryoufeng/laravel-doc
If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php:
Foryoufeng\Doc\DocServiceProvider::class
You need to publish the resource files by run command
php artisan doc:install
After run command you can find add many files in the project
/public/vendor/laravel-doc //styles
/resources/views/docs //views
/resources/mds/docs //markdown doc files
/resources/mds/apidocs //markdown apidoc files
/app/Http/Controllers/Docs //Controllers
config/laravel_doc.php //config
routes/web.php //add access url in the route file
to access the application
-
access
/doc,to see the document -
access
/apidoc,to see the api doc document -
but they are write by Chinese language
How To Use
General document
create your md file in the resources/mds/docs, such asdemo.md,and add your content
then to theapp/Http/Controllers/Docs/LaravelDocController.php,find the methodindex_mdto add data,such as:
private function index_md()
{
return [
[
'name' => config('laravel_doc.languages.install'),
'doc_link' => 'install.md',
],
[
'name' => config('laravel_doc.languages.how_use'),
'doc_link' => 'how_use.md',
],
[
'name' => 'demo',
'doc_link' => 'demo.md',
],
];
}
access to /doc
Controller
the default path for docs to save
$this->mds_path=resource_path('mds/docs/');
- config menus
protected function getMenu()
return [
[
'name'=>config('laravel_doc.languages.project_doc'),
'spread'=>true,//菜单是否展开,false不展开
'children'=>[
'name'=>config('laravel_doc.languages.install'),
'doc_link'=>'install.md',
],
],
[
'name'=>config('laravel_doc.languages.project_doc'),
'spread'=>false,//不展开菜单
'children'=>[
'name'=>config('laravel_doc.languages.install'),
'doc_link'=>'install.md',
],
],
];
}
- after add your menus,add the
doc_linkyou add to theresources/mds/docsfolder
api doc
create your md file in the resources/mds/apidocs, such asdemo.md,and add your content
then to theapp/Http/Controllers/Docs/LaravelApiDocController.php,find the methodindex_mdto add data,such as:
private function index_md()
{
return [
[
'name' => 'apidoc_html',
'doc_link' => 'apidoc_html.md',
'url' => $this->host.'apidoc/html',
'request_type' => 'get',
'params'=>[
'name'=>'apidoc_html.md',
]
],
[
'name' => 'demo',
'doc_link' => 'demo.md',
'url' => $this->host.'apidoc/html',
'request_type' => 'get',
'params'=>[
'name'=>'',
'user_id'=>'',
]
],
];
}
access to /doc
laravel_doc.php
//laravel-doc name
'name' => 'Laravel-doc',
//the author who write the api doc
'author' => env('DOC_AUTHOR','foryoufeng'),
//access token
'token' => env('DOC_TOKEN','doc'),
'languages'=>[
'search'=>'搜索',
'search_result'=>'搜索结果',
'project_doc'=>'项目文档',
'doc_name'=>'文档名称',
'install'=>'安装',
'how_use'=>'使用说明',
'request_type'=>'http请求方式',
'request_url'=>'请求地址',
'send_request'=>'发送请求',
'generate_doc'=>'生成文档',
'welcome_use'=>'欢迎使用',
'param'=>'参数',
'value'=>'值',
'generate'=>'生成',
]
Advanced
to add more project you can copyapp/Http/Controllers/Docs、resources/views/docs,resources/mds/
and copy routes,then change it
//doc route
Route::group(['namespace'=>'Docs'],function (){
Route::get('doc', 'LaravelDocController@index')->name('doc.index');
Route::get('doc/html', 'LaravelDocController@html')->name('doc.html');
Route::get('apidoc', 'LaravelApiDocController@index')->name('doc.apidoc');
Route::get('apidoc/html', 'LaravelApiDocController@html')->name('doc.apidoc.html');
Route::post('apidoc/markdown', 'LaravelApiDocController@markdown')->name('doc.apidoc.markdown');
Route::post('apidoc/save', 'LaravelApiDocController@save')->name('doc.apidoc.save');
});
change languages value in theconfig/laravel_doc.phpto set your own language,Provided by default isChinese
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email foryoufeng@gmail.com instead of using the issue tracker.
License
MIT. Please see the license file for more information.
foryoufeng/laravel-doc 适用场景与选型建议
foryoufeng/laravel-doc 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 1.05k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api docs」 「doc」 「laravel」 「laravel-doc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 foryoufeng/laravel-doc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 foryoufeng/laravel-doc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 foryoufeng/laravel-doc 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Api documentation generator for Laravel 5
Replacement for Swagger. It is built for Laravel
A PSR-7 compatible library for making CRUD API endpoints
Laravel API documentation generating tool
The StyleCI Docs
统计信息
- 总下载量: 1.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-29