- Download the zip
- Unzip and move to folder
wp-content/plugins - Rename with your own name in:
- /wpvr.php
- app/Base/Constants.php
- Run
npm install - Route: Go to
app/Base/Routes.php, add your custom route in function routes(), for example:
// app/Base/Routes.php
[
'slug' => 'home', // path
'method' => 'GET', // verb HTTP
'callback' => [new Home(), 'index'] // name of handle Controller and Function
]- Controller: All the controllers should be stored in
app/Api, for example:
// app/Api/Home.php
<?php
namespace Wpvr\Api;
class Home extends BaseController
{
public function index()
{
$random = random_int(0, 999);
return $this->ok("Your random number is: $random");
}
}- View: Create a Vue component in
js/componentsand take a look tojs/main.jsto integrate the new component by Vue Router.
- When developing the plugin, run
npm run watchto keep the js file updating in case any changes. - When completed, run
npm run prodto minify the bundle js with the smallest size.
- Axios
- Bootstrap Vue
- Vue
- Vue Router
- Vue Loader
- Webpack