Skip to content

Commit 2862e05

Browse files
committed
Add custom logo support
1 parent 5532c4b commit 2862e05

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config/apidoc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,16 @@
8787
],
8888
],
8989
],
90+
91+
/**
92+
* Custom logo path. Will be copied during generate command.
93+
*
94+
* If you want to use this, please be aware of the following rules:
95+
* - filename: logo.png
96+
* - size: 230 x 52
97+
*
98+
* Change false to an absolute path. For example:
99+
* 'logo' => resource_path('views') . '/api/logo.png'
100+
*/
101+
'logo' => false
90102
];

src/Commands/GenerateDocumentation.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Console\Command;
88
use Mpociot\Reflection\DocBlock;
99
use Illuminate\Support\Collection;
10+
use Illuminate\Support\Facades\Storage;
1011
use Mpociot\ApiDoc\Tools\RouteMatcher;
1112
use Mpociot\Documentarian\Documentarian;
1213
use Mpociot\ApiDoc\Postman\CollectionWriter;
@@ -172,6 +173,13 @@ private function writeMarkdown($parsedRoutes)
172173

173174
file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
174175
}
176+
177+
if ($logo = config('apidoc.logo')) {
178+
Storage::copy(
179+
$logo,
180+
$outputPath.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'logo.png'
181+
);
182+
}
175183
}
176184

177185
/**

0 commit comments

Comments
 (0)