Migrating from mpociot/laravel-apidoc-generator to Scribe v3
Scribe is a successor to mpociot/laravel-apidoc-generator
, with a lot of improvements and changes. This guide aims to make migrating to Scribe easier and show you the key parts you need to look out for so things don't break.
The core documentation process remains largely the same. The major changes are in the config file and the advanced customization process.
Requirements​
- PHP version: 7.4+
- Laravel/Lumen version: 6+
Before you start​
Follow the installation guide in the introduction.
Remove the old package:
composer remove mpociot/laravel-apidoc-generator
At this point, you should have both apidoc.php
and scribe.php
in your config folder. This is good, so you can easily compare and copy your old config over and delete when you're done.
_After you've done the above, delete your resources/docs/
and public/docs
folders, to prevent any conflicts with the new ones we'll generate. If you're using laravel
type output, you can also delete resources/views/apidoc/
.
Config file changes​
The
postman.name
key has been removed. Use thetitle
key, which will set both Postman collection name and the generated doc's HTMl title.The
laravel.autoload
key is nowlaravel.add_routes
, and istrue
by default.The
laravel.docs_url
key is now/docs
by default (no longer/doc
). This means if you're usinglaravel
docs type, your docs will be at<your-app>/docs
.The
requestHeaders
stage in thestrategies
item has been renamed toheaders
.Scribe no longer outputs Markdown as an intermediate step, but instead YAML. See details for how to work with them.
The
rebuild
command has been removed. Instead, if you want Scribe to skip the extraction phase and go straight to converting the existing YAML to HTML, runphp artisan scribe:generate --no-extraction
.logo
is nowfalse
by default, so no logo spot will be shown in the docs.If you specify a
logo
, it will no longer be copied to the docs folder. Rather, the path to be logo will be used as-is as thesrc
for the<img>
tag in the docs. This means that you must use a URL or a path that's publicly accessible.For example, if your logo is in
public/img
:- set
'logo' => '../img/logo.png'
forstatic
type (output folder ispublic/docs
) - set
'logo' => 'img/logo.png'
forlaravel
type
- set
Advanced users​
If you've written any custom strategies, you should review Writing Plugins to see how plugins are written now.
If you've published the views, you'll note that they are now in a different format. See the documentation on customising the views to see how things are organised now.
That should be all. If you come across anything we've missed, please send in a PR! We recommend reading through our docs to see all the improvements Scribe comes with.