Laravel API Documentation Generator
Migrating
Note: This isn't meant to be an exhaustive guide to the changes in v4. Please see the changelog for more details (and full list of new features).
Requirements#
- PHP version: 7.2+
- Laravel/Lumen version: 5.7+
Configuration#
-
Rename your old config file (for instance to
apidoc.old.php). Publish the new config file viaphp artisan vendor:publish --provider="Mpociot\ApiDoc\ApiDocGeneratorServiceProvider" --tag=apidoc-config. Then copy over any changes you've made in the old one and delete it when you're done. -
Remove the
outputkey. Source files now go toresources/docs/sourceand generated docs go to eitherpublic/docs/orresources/views/apidoc. -
Make sure the
typevalue is set appropriately. See the docs. -
Remove the
bindingssection. It has been superseded by the@urlParamannotation, which works similarly to the existing@queryParamannotation. See the docs -
Remove the
response_calls.bindingssection. Use theExample:feature of@urlParamto specify the value you want to be used in response calls. -
Rename the
queryandbodysections inresponse_callssection toqueryParamsandbodyParams -
Remove the
apply.response_calls.headers. Move any headers you had there toapply.headers
Assets#
-
If you've published the vendor views, rename them (for instance to
route.old.blade.php). Publish the new views viaphp artisan vendor:publish --provider="Mpociot\ApiDoc\ApiDocGeneratorServiceProvider" --tag=apidoc-views. Compare the two views and reconcile your changes, then delete the old views. Some of the data being passed to the views (the$routeobject) has changed in either name or format, so things will likely break if you use old views. The major change here is the introduction of theurlParameterssection and the collapsing of routetitle,description,groupName,groupDescription, and authentication status (authenticatedinto ametadatasection. -
The location of the source files for the generated docs has changed. Move any prepend/append files you've created from
public/docs/sourceto the new location (resources/docs/source)
API#
- Verify that any custom strategies you've written match the new signatures. See the docs. Also note the order of execution and the new stages present.
Other new features (highlights)#
- Non-static docs/docs with authentication
@apiResourcefor Eloquent API resources- You can now mix and match response strategies and status codes as you like.
Copy any HTML element from any website
Speed up your workflow with Windy – the browser extension that transforms any HTML element into a Tailwind CSS component.
Learn more