| Package Data | |
|---|---|
| Maintainer Username: | bstien |
| Maintainer Contact: | bastian.stien@gmail.com (Bastian Stien) |
| Package Create Date: | 2015-03-02 |
| Package Last Update: | 2015-03-03 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-26 03:06:04 |
| Package Statistics | |
|---|---|
| Total Downloads: | 51 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 16 |
| Total Watchers: | 1 |
| Total Forks: | 4 |
| Total Open Issues: | 0 |
A package for Laravel 5 to scrape for torrents.
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',
];
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.
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);
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 );