定制 rewrewby/tmdb-symfony 二次开发

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

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

rewrewby/tmdb-symfony

Composer 安装命令:

composer require rewrewby/tmdb-symfony

包简介

Symfony2 Bundle for TMDB ( The Movie Database ) API. Provides easy access to the php-tmdb/api library.

README 文档

README

A Symfony2 Bundle for use together with the php-tmdb/api TMDB Wrapper.

Installation

Install Composer

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

Add the following to your require block in composer.json config

"php-tmdb/symfony": "~2.0"

Configuration

Register the bundle in app/AppKernel.php:

    public function registerBundles()
    {
        ...
        new Tmdb\SymfonyBundle\TmdbSymfonyBundle()
        ...
    }

If you haven't had the DoctrineCacheBundle yet, also register it:

    public function registerBundles()
    {
        ...
        new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle()
        ...
    }

Add to your app/config/config.yml the following:

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE

Configure caching

First create a new doctrine_cache provider with a caching provider of your preference.

doctrine_cache:
    providers:
        tmdb_cache:
            file_system:
                directory: %kernel.root_dir%/cache/tmdb

Then update the tmdb configuration with the alias:

tmdb_symfony:
    options:
        cache:
            enabled: true
            handler: tmdb_cache

This caching system will adhere to the TMDB API max-age values, if you have different needs like long TTL's you'd have to make your own implementation. We would be happy to intergrate more options, so please contribute.

Want to make use of logging?

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE
    options:
        cache:
            enabled: true
        log:
            enabled: true
            #path: "%kernel.logs_dir%/tmdb.log"

Disable repositories :

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE
    repositories:
        enabled: false

Disable twig extension :

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE
    twig_extension:
        enabled: false

Disable https :

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE
    options:
        secure:
            enabled: false

Full configuration with defaults :

tmdb_symfony:
    api_key: YOUR_API_KEY_HERE
    repositories:
        enabled: true # Set to false to disable repositories
    twig_extension:
        enabled: true # Set to false to disable twig extensions
    options:
        adapter: null
        secure: true # Set to false to disable https
        host: "api.themoviedb.org/3/"
        session_token: null
        cache:
            enabled: true # Set to false to disable cache
            path: "%kernel.cache_dir%/themoviedb"
            handler: null
            subscriber: null
        log:
            enabled: false # Set to true to enable log
            path: "%kernel.logs_dir%/themoviedb.log"
            level: DEBUG
            handler: null
            subscriber: null

Usage

Obtaining the client

$client = $this->get('tmdb.client');

Obtaining repositories

$movie = $this->get('tmdb.movie_repository')->load(13);

An overview of all the repositories can be found in the services configuration repositories.xml.

There is also a Twig helper that makes use of the Tmdb\Helper\ImageHelper to output urls and html.

{{ movie.backdropImage|tmdb_image_url }}

{{ movie.backdropImage|tmdb_image_html('original', null, 50)|raw }}

For all all other interactions take a look at php-tmdb/api.

rewrewby/tmdb-symfony 适用场景与选型建议

rewrewby/tmdb-symfony 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 05 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 rewrewby/tmdb-symfony 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-12