GithubHelp home page GithubHelp logo

flyman-9527 / php-bittorrent-tracker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xbcn/php-bittorrent-tracker

0.0 0.0 0.0 208 KB

Extensible BitTorrent tracker written in PHP

License: Other

PHP 97.43% Ruby 2.57%

php-bittorrent-tracker's Introduction

PHP BitTorrent Tracker

PHP BitTorrent Tracker is a standalone torrent tracker written in PHP. It is not a complete tracker system with user registration and such (like for instance BtiTracker), but a simple standalone tracker. You can extend it to do user statistics and such using event listeners.

Requirements

PHP BitTorrent Tracker requires PHP 5.3.x or above. The recommended version is 5.3.2 or newer.

It also requires the pecl/mongo extension (>= 1.3.0) or Doctrine DBAL.

Installation

PHP BitTorrent Tracker can be installed using Composer:

wget https://getcomposer.org/installer | php
php composer.phar create-project christeredvartsen/php-bittorrent-tracker

You will also need a web server for the tracker.

Apache

A sample virtual host configuration file can be found in config/tracker.apache.conf.dist.

Built in httpd in php-5.4

You can also use the built in httpd in php-5.4 to run the tracker. This is mostly used for testing purposes. Run the following command in the project root directory to start the tracker on port 1349:

php -S localhost:1349 -t public

If you want to support /announce and /scrape when running the built in httpd, you can use a router:

<?php
if ($_SERVER['SCRIPT_NAME'] === '/announce') {
    require 'public/tracker.php';
    exit;
} else if ($_SERVER['SCRIPT_NAME'] === '/scrape') {
    require 'public/scrape.php';
    exit;
}

return false;

and start the built in httpd like this:

php -S localhost:1349 -t public scripts/router.php

Configuration

The tracker will per default use config/config.default.php for configuration. You can provide your own config/config.php where you can override the default values. If you for instance want to enable automatic registration of new torrents, you can enable it like this in your config/config.php file:

<?php
return array(
    'tracker' => array(
        'autoRegister' => true,
    ),
);

Have a look in the config/config.default.php file to see which configuration values you might want to override.

Event listeners

The tracker enables you to customize the way it works by letting you attach your own event listeners to the triggered events. By using this you can for instance require user id's or specific keys present in the URL (if you want to record download/upload statistics for instance). Such an event listener is shipped with the package, and you can enable it like this in your config/config.php file:

<?php
namespace PHP\BitTorrent\Tracker\Event;

return array(
    // ...

    'eventListeners' => array(
        'userStats' => new Listener\UserStats(),
    ),

    // ...
);

The listener uses MongoDB for storing the data, and is mostly included to showcase the event listener system. Have a look at the documentation in config/config.default.php to see how you can attach listeners if other ways.

Generate downloaded info file for bttrack

If you want to stop using this tracker and migrate to bttrack (the official BitTorrent tracker) you can generate a compatible file using a shell script that ships with PHP BitTorrent Tracker:

./scripts/generateDFile.php > dfile

After doing this you can start bttrack using the generated file:

bttrack --port 1349 --dfile dfile

The script that generates this file uses the current tracker configuration.

php-bittorrent-tracker's People

Contributors

christeredvartsen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.