Root Fields#
Fields of the torrent file that are not parts of the info dictionary.
By changing these fields you’re not creating a separate torrent file (not changing infohash).
All fields can be unset by passing null
.
Announce#
The URL of the tracker.
string
.
<?php
$torrent->setAnnounce('udp://example.com/announce');
$announce = $torrent->getAnnounce();
Announce List#
Note
BEP-12 Multitracker Metadata Extension
A list of lists of tracker URLs. See the type section for acceptable formats.
<?php
// accepts AnnounceList objects or iterables of valid structure
// (same as AnnounceList::fromIterable())
$torrent->setAnnounceList([['udp://example.com/announce']]);
// get Announce List as AnnounceList object
$torrent->getAnnounceList();
// get Announce List as array
$torrent->getAnnounceList()->toArray();
Comment#
Optional description.
string
.
<?php
$torrent->setComment('My Torrent');
$comment = $torrent->getComment();
Created By#
Optional info about the creator.
string
.
<?php
$torrent->setCreatedBy('Me');
$createdBy = $torrent->getCreatedBy();
Creation Date#
Optional info about the creation date.
DateTimeImmutable
.
<?php
// set by DateTime or DateTimeImmutable
$torrent->setCreationDate(new DateTime('now'));
// set by int timestamp
$torrent->setCreationDate(time());
// get DateTimeImmutable object
$creationDate = $torrent->getCreationDate();
// get int timestamp
$creationDate = $torrent->getCreationDate()->getTimestamp();
HTTP Seeds#
Note
BEP-17 HTTP Seeding
A list of HTTP seeding URLs. See the type section for acceptable formats.
<?php
// accepts UriList objects or iterables of valid structure
// (same as UriList::fromIterable())
$torrent->setHttpSeeds(['https://www.whatever.com/seed.php']);
// get Http Seeds as UriList object
$torrent->getHttpSeeds();
// get Http Seeds as array
$torrent->getHttpSeeds()->toArray();
Nodes#
Note
BEP-5 DHT Protocol
A list of DHT nodes. See the type section for acceptable formats.
<?php
// accepts NodeList objects or iterables of valid structure
// (same as NodeList::fromIterable())
$torrent->setNodes([
['127.0.0.1', 6881],
['your.router.node', 4804],
['2001:db8:100:0:d5c8:db3f:995e:c0f7', 1941],
]);
// get Url List as UriList object
$torrent->getNodes();
// get Url List as array
$torrent->getNodes()->toArray();
URL List#
Note
BEP-19 WebSeed - HTTP/FTP Seeding
A list of webseed URLs. See the type section for acceptable formats.
<?php
// accepts UriList objects or iterables of valid structure
// (same as UriList::fromIterable())
$torrent->setUrlList(['https://mirror.com/pub/']);
// get Url List as UriList object
$torrent->setUrlList();
// get Url List as array
$torrent->setUrlList()->toArray();