定制 renus/last-tweet 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

renus/last-tweet

Composer 安装命令:

composer require renus/last-tweet

包简介

Symfony 2 bundle to add quickly last tweets on your website

README 文档

README

Symfony 2 bundle to add quickly last tweets on your website, you can choose and change the screen name, override template and use your own template, this bundle reqiure dependency on abraham/twitteroauth bundle

Installation

prerequisites

when you install RenusLastTweetBundle for symfony, this dependency will be add :

https://github.com/abraham/twitteroauth

installation

1. Add this bundle to your project in composer.json:

{
    "require": {
        "renus/last-tweet": "1.*",
    }
}

2. OR Install with composer

composer.phar require renus/last-tweet dev-master

3. Register the bundle

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new \Renus\LastTweetBundle\RenusLastTweetBundle(),
    );
    // ...
}

#configuration

##application twitter

first you must create an twitter application on https://apps.twitter.com/ ,and create a token (read permission)

##parameters

1.config file

you must add your twitter api parameters in app/config/config.yml, the required parameters must be added like this :

# app/config/config.yml
renus_last_tweet:
    twitter:
        consumer_key: "your_application_key"
        consumer_secret: "your_application_secret_key"
        token: "your_application_token"
        token_secret: "your_application_token_secret"

2. routing file

# app/config/routing.yml
renus_last_tweet:
    resource: "@RenusLastTweetBundle/Resources/config/routing.yml"
    prefix:   /

#Usage

##twig usage:

just add this render command in your twig template (in this example we display the last 3 tweets from the @renus_net account) :

{% render path('renus_last_tweet', {screen: 'renus_net', number: 3}) %}

##controller usage:

if you want to use it in a controller you can get an entity Array with this code:

<?php
// src/controller/someController.php
public function someAction()
{
    $tweets = $this->get('renus.twitter')->getLastTweets($screen, $number);
    // ...
    
    //if you want retweets and mention 
    $tweets = $this->get('renus.twitter')->getLastTweets($screen, $number, false, true);
}

#Override template

if you want to custom the render (in a twig template usage), you cans specify the path of your override template in the app/config/config.yml :

##config

# app/config/config.yml
renus_last_tweet:
    twitter:
        consumer_key: "your_application_key"
        consumer_secret: "your_application_secret_key"
        token: "your_application_token"
        token_secret: "your_application_token_secret"
    template:
        path: "path/of/custom/template/tweet.html.twig"

##template

you can use the "tweets" entitties Array like this :

{% for tweet in tweets %}
    <dl>
        <dt>{{ tweet.getDate() }}</dt>
        <dd>{{ tweet.getFormatText() | raw }}</dd>
    </dl>
{% endfor %}

to see all the 'tweet' parameters open the Entity/Tweet.php

renus/last-tweet 适用场景与选型建议

renus/last-tweet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 236 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 renus/last-tweet 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-09