jacobbennett/phpghostpost 问题修复 & 功能扩展

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

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

jacobbennett/phpghostpost

Composer 安装命令:

composer require jacobbennett/phpghostpost

包简介

A PHP Library for creating usable Post objects from Ghost RSS feeds

README 文档

README

Pull Ghost blog post info from Ghost RSS XML Feed

This library will read an RSS feed from your Ghost blog and return friendly Post objects that you can use to display information about your posts on a PHP page.

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require jacobbennett/ghostxml.

"require": {
	"jacobbennett/phpghostpost": "dev-master"
}

Next, update Composer from the Terminal:

composer update

Finally make sure to place a use statement at the top of your PHP file that will be using the library.

use jacobbennett\phpghostpost\PostCreator;

That’s all. You should now be able to use the PHPGhostPost Library.

Usage

use jacobbennett\phpghostpost\PostCreator;

// Set RSS feed URL
$feedUrl = 'http://youblog.ghost.io/rss/';

// Instantiate a new Post Creator
$PostCreator = new PostCreator($feedUrl);

// Grab and parse the RSS feed into an array of Post objects
$posts = $PostCreator->getPosts();

// Loop through posts and call properties or methods on each
// To display desired information
foreach($posts as $post){
	echo "<h1>" . $post->title . "</h1><br/>";
	echo "Published " . $post->date_ago();
}

Post Object methods and properties

Once you have your array of Post objects returned, here are the methods and properties you can call on each.

Properties

  • title - Title of the post
  • description - Text of post (stripped of html tags)
  • image - URI of first image in post
  • link - Permalink to the post
  • 'date' - Timestamp of publish date

Methods

  • shortDesc($limit) - Return description limited by character count, rounded to end of a word
  • date_ago - Return human readable time-ago string

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固