Skip to content

Commit

Permalink
Adjust file structure to allow for easier installation (#5)
Browse files Browse the repository at this point in the history
* Adjust file structure to allow for easier installation

* Update README
  • Loading branch information
joshcanhelp committed Jan 12, 2021
1 parent ad4a813 commit 4e61a41
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ Install this package:
composer require joshcanhelp/wp-rest-api-auth0
```

### Install manually
Require the autoloader at some point when `add_action` is available, like in `wp-content/mu-plugins`.

To get this running on an existing WordPress site not managed with Composer:
### Install manually

1. Download or clone this repo outside of your WordPress installation
1. Make a directory called `wp-rest-api-auth0` in the root of the repo and move `wp-rest-api-auth0.php` and `composer.json` into that directory
1. [Download Composer locally](https://getcomposer.org/download/) into that direcory and run `php composer.phar install` there
1. Move `wp-rest-api-auth0-loader.php` and the `wp-rest-api-auth0` directory into the `wp-content/mu-plugins` directory of the WordPress install (make one if it does not exist)
To install this manually without Compsoer, just download the [latest release ZIP](https://github.com/joshcanhelp/wp-rest-api-auth0/releases) and upload through the admin interface. Please note that this plugin will not update automatically; updates will need to be made by deleting and re-adding (make sure your site is in maintenance mode) or directly via an FTP client (not recommended).

## Testing with Docker

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"autoload": {
"files": [
"wp-rest-api-auth0.php"
"src/wp-rest-api-auth0.php"
]
}
}
}
File renamed without changes.
15 changes: 9 additions & 6 deletions wp-rest-api-auth0-loader.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
/**
* Loader for joshcanhelp/wp-rest-api-auth0 MU-Plugin.
*
* Copy this file to wp-content/mu-plugins/
* Plugin Name: WP REST API Auth0
* Plugin URL: https://github.com/joshcanhelp/wp-rest-api-auth0
* Description: Protect your WordPress REST API with Auth0
* Version: 1.2.0
* Author: Josh Cunningham <[email protected]>
* Author URI: https://www.joshcanhelp.com
*
* @package WpRestApiAuth0
*/
Expand All @@ -11,9 +14,9 @@

if (
! class_exists( 'Auth0\\SDK\\Helpers\\Tokens\\SymmetricVerifier' )
&& is_file( __DIR__ . '/wp-rest-api-auth0/vendor/autoload.php' )
&& is_file( __DIR__ . '/vendor/autoload.php' )
) {
require_once __DIR__ . '/wp-rest-api-auth0/vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';
}

require_once __DIR__ . '/wp-rest-api-auth0/wp-rest-api-auth0.php';
require_once __DIR__ . '/src/wp-rest-api-auth0.php';

0 comments on commit 4e61a41

Please sign in to comment.