Scenario 1: Scribe keeps getting something wrong. You've tried everything else, and you can't still figure out how to get Scribe to describe
Scenario 2: You want to sort your endpoints or groups in a specific order, but Scribe keeps going alphabetical.
Scenario 3: Some packages (like Laravel Passport or Fortify) add extra routes to your application, but you can't document these the usual way, since you can't edit the controller's docblocks.
If you're in any of these scenarios, you can use the final resort: editing the Camel files.
They're those YAML files that show up in your
.scribe/endpoints folder after running
php artisan scribe:generate. They were added to solve these three exact scenarios, allowing you to override Scribe and pass in external information.
To edit an endpoint or group's details, edit the corresponding Camel file. The Camel files are named
x is a number), and are located in
.scribe/endpoints after generation. Each file contains one group of endpoints, and looks like this:
As you've probably figured, you can edit the contents of this file, and Scribe will respect your changes when next you run
To discard your changes at any time, run
To sort the endpoints in a group, rearrange the endpoints in its
endpoints array. For instance, if your "User management" group is located in
0.yaml and looks like this:
Supposing you want to move the "create a user" endpoint to be first, then simply reorder it in the array to get this:
scribe:generate, and Scribe will put the create a user endpoint first in the output.
If you'd like to sort the groups instead, simply rename the files. For instance, if "User management" is in
0.yaml and "Posts" is in
1.yaml, you can make "Posts" come first by renaming it to
0.yaml and renaming "User management" to
To discard your changes at any time (to both endpoints and groups), run
To add a new endpoint, you need to create a file in the
.scribe/endpoints folder that's named
x is any number. In fact, whenever you run
scribe:generate, you'll see a
custom.0.yaml file show up in your
.scribe/endpoints. This file is commented out, so no changes are added, but it contains an example of how you'd add a new endpoint.
custom.* files have a different format from the other YAML files, so don't copy from one and paste directly into the other.
Here's an example of a
custom.*.yaml file. The file contains an array of endpoints, and you can simply edit the example to add yours: