diff --git a/composer.json b/composer.json index 9249c973..11ea58cf 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "mpociot/laravel-apidoc-generator", + "name": "basvkempen/laravel-apidoc-generator", "license": "MIT", "description": "Generate beautiful API documentation from your Laravel application", "keywords": [ diff --git a/config/apidoc.php b/config/apidoc.php index 8ae737be..42658b87 100644 --- a/config/apidoc.php +++ b/config/apidoc.php @@ -9,6 +9,11 @@ */ 'type' => 'static', + /** + * The base folder the response files are pulled from + */ + 'reponseFileBasePath' => storage_path(), + /* * Static output folder: HTML documentation and assets will be generated in this folder. */ diff --git a/src/Extracting/Strategies/Responses/UseResponseFileTag.php b/src/Extracting/Strategies/Responses/UseResponseFileTag.php index 007f4fc1..fa8f0de9 100644 --- a/src/Extracting/Strategies/Responses/UseResponseFileTag.php +++ b/src/Extracting/Strategies/Responses/UseResponseFileTag.php @@ -56,7 +56,11 @@ protected function getFileResponses(array $tags) $responses = array_map(function (Tag $responseFileTag) { preg_match('/^(\d{3})?\s?([\S]*[\s]*?)(\{.*\})?$/', $responseFileTag->getContent(), $result); $relativeFilePath = trim($result[2]); - $filePath = storage_path($relativeFilePath); + $filePath = storage_path(); + if (config('apidoc.reponseFileBasePath')) { + $filePath = config('apidoc.reponseFileBasePath'); + } + $filePath = $filePath . DIRECTORY_SEPARATOR . $relativeFilePath; if (! file_exists($filePath)) { throw new \Exception('@responseFile ' . $relativeFilePath . ' does not exist'); }