• 使用sami生成文档


    从composer安装sami

    $ composer require sami/sami

    composer自动配置完以后,可以先测试一下是否安装成功。只要不带参数的运行一下sami,就会知道结果。

    $ php vendor/sami/sami/sami.php

    如果不出意外,安装是成功的。那么要使用sami,就需要自己先写一个config.php文件,内容如下:

    use SamiSami;
    //Finder 是一个symfony的文件查找组件,用该组件去匹配文件和目录非常的方便
    use SymfonyComponentFinderFinder;
    
    $dir = __DIR__;
    
    $iterator = Finder::create()
        ->files()
        ->name('*.php')//设置查找的文件类型
        ->exclude('document')//排除不做查找的路径,这里的document是生成的文档所保存的路径
        ->exclude('vendor')//排除composer组件的路径
        ->in($dir)
        ;
    return new Sami($iterator,[
        'theme'             => 'default',//sami安装后默认的有一套文档页面风格模板,名称是default。位置在:vendor/sami/sami/Sami/Resources/themes/下。
        'title'             => 'Mysic',//项目名称
        'build_dir'             => __DIR__.'/document/',//设置文档生成后的保存路径
        'cache_dir'             => __DIR__.'/document/cache/',//设置文档生成时的缓存路径
        'default_opened_level'  => 2
    ]);

    config文件设置好之后,用sami  update一下这个config文件

    $ php vendor/sami/sami/sami.php update config.php

    不出意外的话,文档应该就会生成了,默认的首页名为index.html,只要在浏览器中打开这个文件,就能看到文档了。

  • 相关阅读:
    Zuul token FIlter 验证失败结果输出
    springboot 使用 dev tool 导致 CastException
    索引失效的情况汇总
    JVM笔记-GC常用参数设置
    关于gdb和shp的FID问题
    配置mac百度云同步盘
    【python常用函数1】
    【python环境配置1】 环境变量与常用模块
    【nodejs笔记——小知识点汇总】
    ArcGIS标注
  • 原文地址:https://www.cnblogs.com/mysic/p/6354092.html
Copyright © 2020-2023  润新知