承接 foryoufeng/laravel-doc 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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_link you add to the resources/mds/docs folder

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

  • Multi-project

to add more project you can copyapp/Http/Controllers/Docsresources/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');

});
  • i18n

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 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 1.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-29