2017 © Pedro Peláez
 

library wp_on_laravel

A package that syncs WordPress posts, categories and tags with your laravel project.

image

meesoverdevest/wp_on_laravel

A package that syncs WordPress posts, categories and tags with your laravel project.

  • Thursday, October 5, 2017
  • by webrew
  • Repository
  • 1 Watchers
  • 2 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

WP-on-Laravel

A Laravel Package which makes use of WordPress to easily manage blog content, but also makes it possible to access all WordPress' posts, categories and tags through Eloquent Models., (*1)


Requirements

  • WP CLI globally installed
  • A valid APP_URL in your .env-file

1 Run composer require meesoverdevest/wp_on_laravel

2 Add service provider to config

Add the service provider in config/app.php:, (*2)

 'providers' = [
   ...
   meesoverdevest\wp_on_laravel\WPServiceProvider::class
 ];

3 Run the installer

Run the following from your project folder: php artisan wol:install $password $email, (*3)

Replace $password and $email with your wished credentials to use in WordPress., (*4)

gitignore public/blog if you don't want you content and uploads to be public., (*5)

4 Install Cartalyst Tags

Our package depends on Cartalyst Tags, which installs automatically as dependency. To be able to use Cartalyst Tags with WP_on_Laravel, you have to run their migrations as well. Doing so: $ php artisan vendor:publish --provider="Cartalyst\Tags\TagsServiceProvider" --tag="migrations" or without publishing php artisan migrate --path=vendor/cartalyst/tags/resources/migrations, (*6)

5 Run migration

After running the installation command (php artisan wol:install $password $email), (*7)

Run php artisan migrate to migrate the new migrations, (*8)

6 Edit NGINX config

To enable outer access to the public WordPress installation you have to add the following to your website's nginx config:, (*9)

server {
 ...
  location = /blog {
   return 301 /blog/wp-login.php;
  }

  location /blog/wp-json {
    try_files $uri $uri/ /blog/index.php?$query_string;
  } 

  location /blog/wp-admin {
    try_files $uri $uri/ /blog/index.php?$query_string;
  } 

  location / {
    // standard settings
  }
 ...
}

Don't forget to run (sudo) service nginx restart, (*10)

7 Syncing Wordpress Posts, Categories and Tags

 use meesoverdevest\wp_on_laravel\helpers\WPAPI;

 function syncWP(){
   $WPAPI = new WPAPI();
   $WPAPI->syncWP();
 }

8 Using Wordpress Posts, Categories and Tags

Use them freely inside your project. You can use the models like:, (*11)

 // WPPost 
 use meesoverdevest\wp_on_laravel\models\WPPost;

 // WPCategory 
 use meesoverdevest\wp_on_laravel\models\WPCategory;

 // Tag (managed by Cartalyst/Tags) 
 use meesoverdevest\wp_on_laravel\models\Tag;

 // Show WPCategories for post
 $posts = WPPost::where('parent', 0)->first()->categories();

 // Show WPosts for tag
 $tag = Tag::first()->posts();

 // Show children WPCategories for parent WPCategory
 $tag = WPCategory::first()->children();

====== TODO ======, (*12)

  1. Add Delete Method and Webhooks to Package and functions.php in Wordpress installation
  2. Extend content retrieval methods
  3. Normalize the codebase

The Versions

05/10 2017

dev-master

9999999-dev

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

05/10 2017

1.1.0

1.1.0.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

29/09 2017

1.0.19

1.0.19.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

27/09 2017

1.0.18

1.0.18.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

27/09 2017

1.0.17

1.0.17.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

27/09 2017

1.0.16

1.0.16.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

27/09 2017

1.0.15

1.0.15.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

27/09 2017

1.0.14

1.0.14.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

26/04 2017

0.0.13

0.0.13.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

26/04 2017

1.0.13

1.0.13.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

26/04 2017

1.0.12

1.0.12.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

05/04 2017

1.0.11

1.0.11.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

29/03 2017

1.0.10

1.0.10.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

29/03 2017

1.0.9

1.0.9.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

09/03 2017

1.0.8

1.0.8.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.7

1.0.7.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.6

1.0.6.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.5

1.0.5.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.4

1.0.4.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.2

1.0.2.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.3

1.0.3.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

1.0.1

1.0.1.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package

07/03 2017

v1.0.0

1.0.0.0

A package that syncs WordPress posts, categories and tags with your laravel project.

  Sources   Download

MIT

The Requires

 

by biertjesman

wordpress laravel package