Changed in version 5.0: A lot of stuff was moved to version specific namespaces, see Versioned Info Fields
Fields of the info dictionary of the torrent file. The info dictionary is the primary data of the torrent file. Using any setters here will change infoHash and the result will be considered a separate torrent file by the trackers.
Changed in version 5.0: Specific info hashes were moved into version specific namespaces
A method to get info hashes of the torrent file.
New in version 2.3/3.1.
Get all available hashes as array.
<?php $infoHashes = $torrent->getInfoHashes(); $infoHashes; // V1 info hash if V1 metadata is present $infoHashes; // V2 info hash if V2 metadata is present
Checks the version of the torrent.
<?php $torrent->hasMetadata(MetaVersion::V1); // simple check, does not create v1 Files object // or $torrent->v1() !== null; // if you plan to iterate over files too $torrent->hasMetadata(MetaVersion::V2); // simple check, does not create v2 FileTree object // or $torrent->v2() !== null; // if you plan to iterate over files too
New in version 5.1.
Methods to “unhybridize” hybrid V1+V2 torrents.
Remove a specific version:
or keep a specific version:
A base name of the encoded file or directory.
Setter will do a minimal check that the name can be a valid file name: it should not be empty and should not contain slashes and zero bytes. It also won’t allow you to unset the name.
However the content of the name field in the parsed file is not guaranteed to exist or be valid.
<?php // should be a valid file/dir name $torrent->setName('file.iso'); // stored name may be null or invalid :( $name = $torrent->getName();
BEP-27 Private Torrents
Get / set / unset the private flag.
<?php $isPrivate = $torrent->isPrivate(); $torrent->setPrivate(true);