|
1 | 1 | # StackExchangeBackupLaravel
|
| 2 | + |
2 | 3 | Allows you to export JSON files of your most important data (questions, answers, comments, favorites) from each of your Stack Exchange sites (Stack Overflow, Super User, Server Fault, etc).
|
3 | 4 |
|
4 | 5 | ## Installation
|
5 | 6 |
|
6 |
| - 1. I think this project requires PHP 7.3 or later, so be sure that your system complies. |
7 |
| - 1. Sign up at https://stackapps.com/apps/oauth/register to receive a Client ID, Client Secret, and Key. (It's free, easy, and fast.) |
8 |
| - 1. Create a Laravel project, and make sure that it works: https://laravel.com/docs/5.8/installation#installing-laravel |
9 |
| - 1. Add this package into your Laravel project: `vagrant@vboxHomestead:~/Code/MyLaravelProject$ composer require ryancwalsh/stack-exchange-backup-laravel:dev-master --prefer-source` |
10 |
| - 1. Run `php artisan vendor:publish`, and if it gives you a choice, choose to publish from this package. |
| 7 | +There is no need to clone this repository, the installation works with _PHP composer_. It will install the _Laravel_ framework and add this project to the app. |
| 8 | + |
| 9 | + 1. This is only tested on PHP 7.3, so be sure that your system complies. |
| 10 | + 1. Sign up at https://stackapps.com/apps/oauth/register to receive a Client ID, Client Secret, and Key (it's free, easy, and fast). Note: use `stackexchange.com` for `OAuth Domain` in the setup. |
| 11 | + 1. Create a [Laravel project](https://laravel.com/docs/5.8/installation#installing-laravel) for this app, and make sure that it works: |
| 12 | + |
| 13 | + mkdir ~/Code/Laravel |
| 14 | + cd ~/Code/Laravel |
| 15 | + composer global require laravel/installer |
| 16 | + # on Ubuntu 18.04 and Debian 9+: |
| 17 | + echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc |
| 18 | + # on other systems this might be |
| 19 | + # echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc |
| 20 | + # apply PATH: |
| 21 | + source ~/.bashrc |
| 22 | + # create the laravel project for this app: |
| 23 | + laravel new se_backup_project |
| 24 | + 1. Add this package into your Laravel project in the parent folder of the app folder: |
| 25 | + |
| 26 | + cd se_backup_project/ |
| 27 | + composer require ryancwalsh/stack-exchange-backup-laravel:dev-master --prefer-source |
| 28 | + 1. Run _artisan_, and choose to publish the "Provider" from this package: `ryancwalsh\StackExchangeBackupLaravel\ExportStackExchangeServiceProvider` |
| 29 | + |
| 30 | + php artisan vendor:publish |
11 | 31 | 1. Edit your Laravel project's `.env` file to have your own StackApps values. A non-working sample is below.
|
12 |
| - 1. Run `php artisan exportStackExchange`. (Note that `php artisan exportStackExchange --flushCache` is an available option to clear the cached access code value.) |
13 |
| - 1. Following the instructions in the terminal, you'll use your browser to visit a URL that will provide you with a temporary access token to paste into the terminal. |
| 32 | + 1. Run |
| 33 | + |
| 34 | + php artisan exportStackExchange |
| 35 | + (Note that `php artisan exportStackExchange --flushCache` is the option to clear the cached access codevalue.) |
| 36 | + 1. Following the instructions in the terminal, you'll use your browser to visit a URL that will provide you with a temporary access token to paste into the terminal. |
| 37 | + (Note: you'll find the token in the `code` part of the URL of the page showing "Authorizing Application" like `https://stackexchange.com/oauth/login_success?code=TLBxyz...`) |
14 | 38 | 1. Finished! The JSON files will appear in your `/storage/app/StackExchange` folder.
|
15 | 39 |
|
16 | 40 | ```
|
17 | 41 | # These are sample .env values:
|
18 |
| -STACKAPPS_CLIENT_ID=12227 |
19 |
| -STACKAPPS_CLIENT_SECRET=ydxGSDFHDF4DtZqCesr)yJIw(( |
20 |
| -STACKAPPS_KEY=JuWsTgfG2CqjdghkhdgBkQ(( |
| 42 | +STACKAPPS_CLIENT_ID=<your Client Id> |
| 43 | +STACKAPPS_CLIENT_SECRET=<your Client Secret> |
| 44 | +STACKAPPS_KEY=<your Key> |
| 45 | +# optional, in case you want to use AWS: |
21 | 46 | AWS_ACCESS_KEY_ID=AKIAmb3mbn56mn6
|
22 | 47 | AWS_SECRET_ACCESS_KEY=jl234k5jl23k45j23lj5
|
23 | 48 | AWS_DEFAULT_REGION=us-east-1
|
24 | 49 | AWS_BUCKET=xyz
|
25 | 50 | ```
|
26 | 51 |
|
27 |
| - |
28 |
| - |
29 | 52 | ## If You Use This Package, Let Me Know!
|
| 53 | + |
30 | 54 | **This is the first package that I've ever made, and I'm super curious if anyone will ever use it. If you do try it out, I'd love for you to [open an issue](https://github.com/ryancwalsh/StackExchangeBackupLaravelPHP/issues/new) to say hi** (and of course to tell me any suggestions you have).
|
31 | 55 |
|
32 | 56 | ___
|
33 | 57 |
|
34 | 58 | ### If You Want To Get Creative...
|
35 |
| -Visit https://api.stackexchange.com/docs to read the docs, and you can modify `ExportStackExchangeHelper.php` to do whatever you want. The Stack Exchange API is great. |
36 |
| - |
37 | 59 |
|
| 60 | +Visit https://api.stackexchange.com/docs to read the docs, and you can modify `ExportStackExchangeHelper.php` to do whatever you want. The Stack Exchange API is great. |
38 | 61 |
|
39 | 62 | ### Other Resources That Helped Me
|
40 | 63 |
|
|
0 commit comments