apidoc.php 7.8 KB

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