apidoc.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. return [
  3. /*
  4. * The output path for the generated documentation.
  5. * This path should be relative to the root of your application.
  6. */
  7. 'output' => 'public/docs',
  8. /*
  9. * The router to be used (Laravel or Dingo).
  10. */
  11. 'router' => 'laravel',
  12. /*
  13. * The base URL to be used in examples and the Postman collection.
  14. * By default, this will be the value of config('app.url').
  15. */
  16. 'base_url' => null,
  17. /*
  18. * Generate a Postman collection in addition to HTML docs.
  19. */
  20. 'postman' => [
  21. /*
  22. * Specify whether the Postman collection should be generated.
  23. */
  24. 'enabled' => true,
  25. /*
  26. * The name for the exported Postman collection. Default: config('app.name')." API"
  27. */
  28. 'name' => null,
  29. /*
  30. * The description for the exported Postman collection.
  31. */
  32. 'description' => null,
  33. ],
  34. /*
  35. * The routes for which documentation should be generated.
  36. * Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
  37. * and rules which should be applied to them ('apply' section).
  38. */
  39. 'routes' => [
  40. [
  41. /*
  42. * Specify conditions to determine what routes will be parsed in this group.
  43. * A route must fulfill ALL conditions to pass.
  44. */
  45. 'match' => [
  46. /*
  47. * Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
  48. */
  49. 'domains' => [
  50. '*',
  51. // 'domain1.*',
  52. ],
  53. /*
  54. * Match only routes whose paths match this pattern (use * as a wildcard to match any characters).
  55. */
  56. 'prefixes' => [
  57. '*',
  58. // 'users/*',
  59. ],
  60. /*
  61. * Match only routes registered under this version. This option is ignored for Laravel router.
  62. * Note that wildcards are not supported.
  63. */
  64. 'versions' => [
  65. 'v1',
  66. ],
  67. ],
  68. /*
  69. * Include these routes when generating documentation,
  70. * even if they did not match the rules above.
  71. * Note that the route must be referenced by name here (wildcards are supported).
  72. */
  73. 'include' => [
  74. // 'users.index', 'healthcheck*'
  75. ],
  76. /*
  77. * Exclude these routes when generating documentation,
  78. * even if they matched the rules above.
  79. * Note that the route must be referenced by name here (wildcards are supported).
  80. */
  81. 'exclude' => [
  82. // 'users.create', 'admin.*'
  83. ],
  84. /*
  85. * Specify rules to be applied to all the routes in this group when generating documentation
  86. */
  87. 'apply' => [
  88. /*
  89. * Specify headers to be added to the example requests
  90. */
  91. 'headers' => [
  92. 'Content-Type' => 'application/json',
  93. 'Accept' => 'application/json',
  94. // 'Authorization' => 'Bearer {token}',
  95. // 'Api-Version' => 'v2',
  96. ],
  97. /*
  98. * If no @response or @transformer declarations are found for the route,
  99. * we'll try to get a sample response by attempting an API call.
  100. * Configure the settings for the API call here.
  101. */
  102. 'response_calls' => [
  103. /*
  104. * API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc).
  105. * List the methods here or use '*' to mean all methods. Leave empty to disable API calls.
  106. */
  107. 'methods' => ['GET'],
  108. /*
  109. * Laravel config variables which should be set for the API call.
  110. * This is a good place to ensure that notifications, emails
  111. * and other external services are not triggered
  112. * during the documentation API calls
  113. */
  114. 'config' => [
  115. 'app.env' => 'documentation',
  116. 'app.debug' => false,
  117. // 'service.key' => 'value',
  118. ],
  119. /*
  120. * Cookies which should be sent with the API call.
  121. */
  122. 'cookies' => [
  123. // 'name' => 'value'
  124. ],
  125. /*
  126. * Query parameters which should be sent with the API call.
  127. */
  128. 'queryParams' => [
  129. // 'key' => 'value',
  130. ],
  131. /*
  132. * Body parameters which should be sent with the API call.
  133. */
  134. 'bodyParams' => [
  135. // 'key' => 'value',
  136. ],
  137. ],
  138. ],
  139. ],
  140. ],
  141. 'strategies' => [
  142. 'metadata' => [
  143. \Mpociot\ApiDoc\Strategies\Metadata\GetFromDocBlocks::class,
  144. ],
  145. 'urlParameters' => [
  146. \Mpociot\ApiDoc\Strategies\UrlParameters\GetFromUrlParamTag::class,
  147. ],
  148. 'queryParameters' => [
  149. \Mpociot\ApiDoc\Strategies\QueryParameters\GetFromQueryParamTag::class,
  150. ],
  151. 'bodyParameters' => [
  152. \Mpociot\ApiDoc\Strategies\BodyParameters\GetFromBodyParamTag::class,
  153. ],
  154. 'responses' => [
  155. \Mpociot\ApiDoc\Strategies\Responses\UseResponseTag::class,
  156. \Mpociot\ApiDoc\Strategies\Responses\UseResponseFileTag::class,
  157. \Mpociot\ApiDoc\Strategies\Responses\UseApiResourceTags::class,
  158. \Mpociot\ApiDoc\Strategies\Responses\UseTransformerTags::class,
  159. \Mpociot\ApiDoc\Strategies\Responses\ResponseCalls::class,
  160. ],
  161. ],
  162. /*
  163. * Custom logo path. The logo will be copied from this location
  164. * during the generate process. Set this to false to use the default logo.
  165. *
  166. * Change to an absolute path to use your custom logo. For example:
  167. * 'logo' => resource_path('views') . '/api/logo.png'
  168. *
  169. * If you want to use this, please be aware of the following rules:
  170. * - the image size must be 230 x 52
  171. */
  172. 'logo' => false,
  173. /*
  174. * Name for the group of routes which do not have a @group set.
  175. */
  176. 'default_group' => 'general',
  177. /*
  178. * Example requests for each endpoint will be shown in each of these languages.
  179. * Supported options are: bash, javascript, php, python
  180. * You can add a language of your own, but you must publish the package's views
  181. * and define a corresponding view for it in the partials/example-requests directory.
  182. * See https://laravel-apidoc-generator.readthedocs.io/en/latest/generating-documentation.html
  183. *
  184. */
  185. 'example_languages' => [
  186. 'bash',
  187. 'javascript',
  188. ],
  189. /*
  190. * Configure how responses are transformed using @transformer and @transformerCollection
  191. * Requires league/fractal package: composer require league/fractal
  192. *
  193. */
  194. 'fractal' => [
  195. /* If you are using a custom serializer with league/fractal,
  196. * you can specify it here.
  197. *
  198. * Serializers included with league/fractal:
  199. * - \League\Fractal\Serializer\ArraySerializer::class
  200. * - \League\Fractal\Serializer\DataArraySerializer::class
  201. * - \League\Fractal\Serializer\JsonApiSerializer::class
  202. *
  203. * Leave as null to use no serializer or return a simple JSON.
  204. */
  205. 'serializer' => null,
  206. ],
  207. /*
  208. * If you would like the package to generate the same example values for parameters on each run,
  209. * set this to any number (eg. 1234)
  210. *
  211. */
  212. 'faker_seed' => null,
  213. ];