Laravel mpociot/Laravel-apidoc-generator 设置 修改 logo

我们在 laravel 中使用 mpociot/Laravel-apidoc-generator 生成 api文档的时候,会有这么一个展示页面

在页面的左上角有个logo,默认是这个样子的,那么如何修改这个logo呢,换成我们自己的logo;

 

配置方法:

在项目目录中找到 apidoc.php 这个文件就是用来配置相关信息的;

我这里测试用的 laravel 6 版本项目,位置在: /config/apidoc.php 

如果不在这里的话,可以在项目目录中全局搜索一下 apidoc.php 这个文件

 

打开这个文件,我们找到下面的代码:

/*
     * Custom logo path. The logo will be copied from this location
     * during the generate process. Set this to false to use the default logo.
     *
     * Change to an absolute path to use your custom logo. For example:
     * 'logo' => resource_path('views') . '/api/logo.png'
     *
     * If you want to use this, please be aware of the following rules:
     * - the image size must be 230 x 52
     */
    'logo' => false,

这就是默认的设置和一些说明信息,

我们修改如下即可:

'logo' => resource_path('docs') . '/images/logo2.png',

我们换了一张 logo2.png 图片替换了原来的图片;

我把这张 logo2.png 图片放在了 /resources/docs/images/logo2.png

因为你会发现 docs 目录就在 resources 目录下

 

这个 docs目录就是我们的文档 api 文件;

 

最后我们生成 api文档的时候,/public 目录下也会增加这个可访问的 api 文档文件;

我们设置完成保存文件后,重新生成 api 文档,logo就会替换掉了,我这里的logo图片是截取了windows操作系统的计算机管理界面的一小块,不要介意

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
APIDOC是一个用于生成RESTful API文档的工具,它可以从代码注释中提取特定格式的内容生成文档。它支持多种开发语言,如GO、Java、C、Rust等。使用APIDOC可以方便地为后端代码编写接口文档,并且可以自动生成文档。在Node.js项目中使用APIDOC,你需要新建一个文件夹来存放生成的文档,并在项目的启动文件(如app.js)中添加相应的配置,示例代码如下:app.use('/apidoc存放的位置',express.static('apidoc存放的位置'));其中,'apidoc存放的位置'是你存放APIDOC生成的文件的路径,通过访问相应的URL地址,即可自动运行生成API文档。<span class=&quot;em&quot;>1</span><span class=&quot;em&quot;>2</span><span class=&quot;em&quot;>3</span> #### 引用[.reference_title] - *1* [Node与apidoc的邂逅——NodeJS Restful 的API文档生成](https://blog.csdn.net/weixin_33953249/article/details/93345878)[target=&quot;_blank&quot; data-report-click={&quot;spm&quot;:&quot;1018.2226.3001.9630&quot;,&quot;extra&quot;:{&quot;utm_source&quot;:&quot;vip_chatgpt_common_search_pc_result&quot;,&quot;utm_medium&quot;:&quot;distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2&quot;}}] [.reference_item style=&quot;max-width: 50%&quot;] - *2* *3* [APIDOC- API文档生成工具——node](https://blog.csdn.net/mantou_riji/article/details/125697962)[target=&quot;_blank&quot; data-report-click={&quot;spm&quot;:&quot;1018.2226.3001.9630&quot;,&quot;extra&quot;:{&quot;utm_source&quot;:&quot;vip_chatgpt_common_search_pc_result&quot;,&quot;utm_medium&quot;:&quot;distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2&quot;}}] [.reference_item style=&quot;max-width: 50%&quot;] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值