承接 kgengler/feed-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kgengler/feed-client

Composer 安装命令:

composer require kgengler/feed-client

包简介

An Atom and RSS feed client for the Laravel Framework

README 文档

README

Packagist

This branch is for Laravel 4.x

An Atom and RSS feed client for the Laravel Framework

Installation

Add the following line to the require section of composer.json:

{
    "require": {
        "kgengler/feed-client": "4.*"
    }
}

Run composer update.

Configuration

Publish the package configuration using Artisan.

php artisan config:publish kgengler/feed-client

Find the providers key in your app/config/app.php and register the Feed Client Service Provider.

'providers' => array(
    // ...
    'Kgengler\FeedClient\FeedClientServiceProvider',
)

Find the aliases key in your app/config/app.php and add the Feed Client facade alias.

'aliases' => array(
    // ...
    'FeedClient' => 'Kgengler\FeedClient\FeedClientFacade'
)

Open the configuration file in app/config/packages/kgengler/feed-client/config.php, and add the feed you need to access

<?php
// app/config/packages/kgengler/feed-client/config.php

return array(
    // The `laravel` key here is used to fetch the feed later. You can specify multiple
    // feeds, just use another key.
    'laravel' => array(
        
        // Feed type, either `atom` or `rss`
        // Required
        // Default: none
        'type'          => 'atom',
        
        // Url of the feed
        // Required
        // Default: none
        'url'           => 'https://github.com/laravel/laravel/commits/master.atom',
        
        // username required to access feed
        // Optional
        // Default: null
        'user'          => null,
        
        // password required to access feed
        // Optional
        // Default: null
        'password'      => null,
        
        // whether or not to cache the feed locally. I would recommend leaving this
        // on, unless you plan on caching it yourself. It will use whatever cache
        // driver you have specified for your application.
        // Optional
        // Default: true
        'cached'        => true,
        
        // time in minutes to cache feed
        // Optional
        // Default: 60
        'cacheTimeout'  => 60
    )
);

Usage

Fetch the client from the Laravel IOC Container and get the feed with the key you provided in the configuration file:

$feed_client = App::make('feed-client');
$feed = $feed_client->get('laravel');

// or with the Facade
$feed = FeedClient::get('laravel');

Access methods to get the information from the feed:

$feed->getTitle(); // Feed Title
$feed->getDescription(); // Feed Description
$feed->getLink(); // Link to feed

$feed_items = $feed->getItems(); // Items in feed

// Feed items are given as a collection of FeedItem objects
foreach($feed_items as $item) {
    $item->getTitle(); // Item Title
    $item->getTime(); // Publication Time as DateTime object
    $item->getLink(); // Get link for Item
    $item->getDescription(); // Item Description
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-12-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固