Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Torrent File

Torrent File Laravel Package

arokettu/torrent-file

A PHP library for reading, creating, and editing BitTorrent .torrent files. It handles bencoding, v1 and v2 (and hybrid) torrents, and metadata, making it easy to generate or inspect torrents in your PHP applications.

Deep Wiki
Context7

arokettu/torrent-file is a PHP library for reading and writing .torrent files (BitTorrent metainfo, BEP 3), built on top of arokettu/bencode. It parses existing torrents into typed objects and creates new ones, including the info dictionary, piece hashes, and multi-file layouts—so you can inspect or generate torrents without hand-assembling bencode structures.

  • Parse and build single- and multi-file torrents
  • Typed access to files, piece length, and hash data
  • Seamless bencode encoding/decoding via a companion package
  • PSR-friendly, Composer-installable PHP API
Frequently asked questions about Torrent File
How do I install arokettu/torrent-file in Laravel?
Install it with Composer using composer require arokettu/torrent-file. It is a framework-agnostic PSR-4 package, so no Laravel service provider or config publishing is required. After installation, wrap it behind your own service or adapter before using it in controllers or jobs.
Does arokettu/torrent-file support BitTorrent v2 and hybrid torrents?
The package is described as supporting BitTorrent v1, v2, and hybrid torrents, including bencode encoding and decoding. Because v2 and hybrid behavior is a critical compatibility area, confirm the exact support in the installed version with real sample torrents. Test info dictionary handling and info hash derivation before relying on it in production.
Can I use arokettu/torrent-file to parse user-uploaded .torrent files safely in Laravel?
You can parse uploaded torrent files, but you must treat bencode as untrusted input. Enforce upload size limits, parsing limits, and timeouts at the Laravel boundary, and avoid parsing in the request path without guards. The library is a codec and data model, not a security control, so validate paths and metadata in your application.
How do I create a .torrent file with arokettu/torrent-file?
Use the package to build the metainfo structure, populate announce URLs, the info dictionary, file lists, and piece hashes, then encode it as bencode. The package handles the bencode serialization and torrent data model, but you still need to compute piece hashes from the actual payload files. In Laravel, keep this in a dedicated service or queued job rather than inside a controller.
Is arokettu/torrent-file compatible with Laravel 11 and PHP 8?
The package is framework-agnostic and should work with standard Laravel stacks that use Composer and supported PHP 8.x versions. Check its Composer PHP constraint and confirm that arokettu/bencode does not conflict with packages already in composer.lock. Laravel itself does not need special integration because there is no provider or facade requirement.
Do I need a service provider or facade for arokettu/torrent-file in Laravel?
No. arokettu/torrent-file is a plain Composer library with no Laravel service provider, facade, migrations, or configuration publishing. The recommended pattern is a thin application-owned TorrentFileService or port interface that wraps the vendor classes. That keeps your Laravel code independent of the package namespace and makes future replacement or forking cheaper.
How do I calculate or extract the info hash with arokettu/torrent-file?
The info hash is derived from the raw bencoded info dictionary, so you need access to those exact bytes rather than a re-encoded or normalized array. Confirm how your installed version exposes the raw info dictionary, then compute the hash in your application code. For v2 and hybrid torrents, verify the expected hash algorithm and representation against real torrents.
Does arokettu/torrent-file hash files or build piece hashes for large torrents?
No, it is a bencode codec and torrent data-model library, not a torrent engine or file hasher. You must read the payload files, split them into pieces, and compute the piece hashes yourself before inserting them into the torrent structure. For multi-gigabyte torrents, do this in a queued job and watch memory usage rather than assembling everything in the request path.
What happens when arokettu/torrent-file parses malformed or malicious bencode?
Malformed input should surface as package exceptions rather than silently producing a valid torrent, but confirm the failure behavior in your installed version. Bencode is attacker-controlled, so deeply nested or oversized structures can still cause CPU or memory exhaustion if you do not guard parsing. Apply file size caps, nesting limits, and timeouts in Laravel before calling the parser.
Is arokettu/torrent-file maintained and production-ready, or should I use an alternative?
It is a small, low-star package with sparse documentation and one primary maintainer, so treat supply-chain risk as real. Pin the version, vendor the dependency if needed, and keep your own adapter boundary so a fork remains a contained cost; the MIT license permits that. For production, validate it against real v1, v2, and hybrid torrents and compare outputs with existing tools before migrating.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core