a4x/laravel-wordpress
Composer 安装命令:
composer require a4x/laravel-wordpress
包简介
A one-class package that locally caches your Wordpress posts as a Laravel collection
关键字:
README 文档
README
This library wraps your blog posts into a Laravel collection.
Installation
composer require "a4x/laravel-wordpress:0.0.1-beta"
Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:
'A440\Wordpress\WordpressServiceProvider'
Finally, you will want to publish the config using the following command:
php artisan vendor:publish --provider="A440\Wordpress\WordpressServiceProvider"
Then, update your config/wordpress.php file with your Wordpress installation URL or IP.
And you're done!
Basic Usage
<?php namespace App\Http\Controllers; use A440\Wordpress\Wordpress; class HomeController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Wordpress $wp) { $posts = $wp->posts() ->sortByDesc('date') ->where('author.name', 'Matthew Crist') ->forPage(1, 4); dd($posts); } }
Now you can access your blog posts and categories just like from an Eloquent model.
统计信息
- 总下载量: 291
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-05