apidoc.php 8.4 KB

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