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
Changed in version 3.0: AnnounceList
object is returned instead of array of arrays
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#
Changed in version 3.0: DateTimeImmutable
is returned instead of int
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(['udp://example.com/seed']);
// 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(['udp://example.com/seed']);
// 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(['udp://example.com/seed']);
// get Url List as UriList object
$torrent->setUrlList();
// get Url List as array
$torrent->setUrlList()->toArray();