bstien/laravel-torrent 问题修复 & 功能扩展

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

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

bstien/laravel-torrent

最新稳定版本:0.1.0

Composer 安装命令:

composer require bstien/laravel-torrent

包简介

Search for torrents with this package

README 文档

README

A package for Laravel 5 to scrape for torrents.

Installation

Add this to your composer.json:

"require": {
    "bstien/laravel-torrent": "dev-master"
}

Register the facade and ServiceProvider in config/app.php:

'providers' => [
    // ...
    'Stien\Torrent\TorrentServiceProvider',
];

'aliases' => [
    // ...
    'Torrent    => 'Stien\Torrent\Facades\Torrent',
];

Usage

Regular search

Returns an array with Stien\Torrent\Result\Torrent-objects if matches are found. If not, an empty array is returned.

use Stien\Torrent\Facades\Torrent;
# You can register this to your facades-array in config/app.php if you like

$torrents = Torrent::search("Modern Family");

foreach( $torrents as $torrent )
{
    echo $torrent->getTitle();
}


# To search within a specific category, use any of the constants in
# Stien\Torrent\Categories.

Search in category

Include a category as the second argument to Torrent::search(). See constants in Stien\Torrent\Categories for reference.

It defaults to Categories::ALL if none are given.

use Stien\Torrent\Facades\Torrent;
use Stien\Torrent\Categories as CAT;

$torrents = Torrent::search("Die Hard", CAT::MOVIES_HD);

Implement your own adapter

To extend this package with another adapter, create a new class and have it implement Stien\Torrent\TorrentAdapterInterface.

Register your adapter with the scraper

use Stien\Torrent\Facades\Torrent;

$myAdapter = new MyAdapter();
$myAdapter->setHttpClient(new \GuzzleHttp\Client);

Torrent::addAdapter( $myAdapter );

统计信息

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

GitHub 信息

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

其他信息

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