]> BookStack Code Mirror - api-scripts/blob - php-export-all-books/readme.md
Added the Flutter/Dart example (#12)
[api-scripts] / php-export-all-books / readme.md
1 # Export All Books
2
3 This script will export all books in your preferred format (PDF, HTML, Markdown or TXT).
4
5 ## Requirements
6
7 You will need php (~7.1+) installed on the machine you want to run this script on.
8 You will also need BookStack API credentials (TOKEN_ID & TOKEN_SECRET) at the ready.
9
10 ## Running
11
12 ```bash
13 # Downloading the script
14 curl https://raw.githubusercontent.com/BookStackApp/api-scripts/main/php-export-all-books/export-books.php > export-books.php
15
16 # Setup
17 # ALTERNATIVELY: Open the script and edit the variables at the top.
18 export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
19 export BS_TOKEN_ID=abc123 # Set to be your API token_id
20 export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
21
22 # Running the script
23 php export-books.php <format> <output_dir>
24 ```
25
26 ## Examples
27
28 ```bash
29 # Export as plaintext to an existing "out" directory
30 php export-books.php plaintext ./out
31
32 # Export as pdf to the current directory
33 php export-books.php pdf ./
34
35 # Export as HTML to an existing "html" directory
36 php export-books.php html ./html
37
38 # Export as Markdown to an existing "md-files" directory
39 php export-books.php markdown ./md-files
40 ```