soltys / slate-bundle
This bundle provides a configurable Slate documentation for your REST APIs.
Installs: 2 348
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 2
Open Issues: 0
Language:HTML
Type:symfony-bundle
Requires
- php: >=5.5.9
- erusev/parsedown: ^1.6
- symfony/console: ~2.3|~3.0
- symfony/framework-bundle: ~2.3|~3.0
- symfony/twig-bundle: ^2.7 || ^3.0
This package is auto-updated.
Last update: 2022-02-01 13:11:15 UTC
README
This bundle provides a configurable Slate documentation for your REST APIs.
Step 1: Download the Bundle
Add SoltysSlateBundle to your project via Composer:
$ composer require soltys/slate-bundle "~1"
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Soltys\Bundle\SoltysSlateBundle\SoltysSlateBundle(), ); // ... } // ... }
Step 3: Configure the Bundle
In your routing.yml
file add the following lines:
# app/config/routing.yml SoltysSlateBundle: resource: "@SoltysSlateBundle/Resources/config/routing.yml" prefix: /api/documentation
Then configure the bundle by adding the following in your config.yml
:
# app/config/config.yml soltys_slate: language_tabs: ["shell", "ruby", "python", "javascript"] includes: ["SoltysSlateBundle:Slate/Includes:_errors.md.twig"] toc_footers: ["SoltysSlateBundle:Slate/Footers:_footer.html.twig"]
The full bundle configuration reference is below:
# app/config/config.yml soltys_slate: title: "API Documentation" # Your documentation title navbar_path: "bundles/soltysslate/images/navbar.png" # Your navbar image path logo_path: "bundles/soltysslate/images/logo.png" # Your logo path with_search: true # Enable/Disable the search bar page_classes: "index" # Add this CSS class to the HTML <body> tag language_tabs: ["shell", "ruby", "python", "javascript"] # List the languages in which you want to write your examples includes: ["SoltysSlateBundle:Slate/Includes:_errors.md.twig"] # Additional templates toc_footers: ["SoltysSlateBundle:Slate/Footers:_footer.html.twig"] # Footer template
You can now install your assets with the following command:
$ bin/console assets:install web --symlink
Then clear your cache:
$ bin/console cache:clear
Step 4: Usage
To write your own documentation (unless if you like kittens), create an index.md.twig
file under
the app/Resources/SoltysSlateBundle/views/Slate/MarkDown
directory to override the
default one.