meesoverdevest/wp_on_laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

meesoverdevest/wp_on_laravel

Composer 安装命令:

composer require meesoverdevest/wp_on_laravel

包简介

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

README 文档

README

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.

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:

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

3 Run the installer

Run the following from your project folder: php artisan wol:install $password $email

Replace $password and $email with your wished credentials to use in WordPress.

gitignore public/blog if you don't want you content and uploads to be public.

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

5 Run migration

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

Run php artisan migrate to migrate the new migrations

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:

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

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:

 // 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 ======

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

meesoverdevest/wp_on_laravel 适用场景与选型建议

meesoverdevest/wp_on_laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 65 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「wordpress」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 meesoverdevest/wp_on_laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 meesoverdevest/wp_on_laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 meesoverdevest/wp_on_laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 65
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-07