yuzuru-s/post-to-wp

这个PHP库可以轻松将文章及其缩略图发布到WordPress

1.0.4 2016-11-24 03:20 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:53:14 UTC


README

Coverage Status Build Status Stable Version Download Count License

要求

  • PHP
    • =5.5 >=5.6, >=7.0

  • ext-xmlrpc
  • Composer

安装

  • 使用Composer
{
    "require": {
       "yuzuru-s/post-to-wp": "1.0.*"
    }
}
$ php composer.phar update yuzuru-s/post-to-wp --dev

如何使用

请检查示例代码

<?php
require __DIR__ . '/../vendor/autoload.php';
use YuzuruS\Wordpress\Post;

// endpoint → example.com
$wp = new Post(getenv(WP_USERNAME), getenv(WP_PASSWD), getenv(WP_ENDPOINT));

$res = $wp->makeCategories([
	['name' => 'かて1', 'slug' => 'cate1'],
	['name' => 'かて2', 'slug' => 'cate2'],
]);

$wp
	->setTitle('たいとる')
	->setDescription('本文')
	->setKeywords(['key1','key2'])
	->setCategories(['かて1','かて2'])
	->setDate('2016-11-11')
	->setWpSlug('entry')
	->setThumbnail('https://www.pakutaso.com/shared/img/thumb/SAYA160312500I9A3721_TP_V.jpg')
	->post();

如何运行单元测试

使用默认设置运行。

% vendor/bin/phpunit -c phpunit.xml.dist

当前已测试PHP 7.0.0

历史

许可协议

版权(c)2016 YUZURU SUZUKI。有关详细信息,请参阅MIT-LICENSE。

版权