Weave Code
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

Net Ftp Laravel Package

pear/net_ftp

PEAR Net_FTP is a PHP library for connecting to FTP servers, browsing directories, and transferring files. It provides an object-oriented API for common FTP operations like login, upload/download, rename, delete, and permissions handling.

View on GitHub
Deep Wiki
Context7

Getting Started

This package is an archived PEAR package (pear/net_ftp) offering a minimal OOP wrapper over PHP’s native ftp_* functions. Due to its age (archived, unmaintained, 3 stars), it should only be used when maintaining existing legacy systems that already depend on it—never for new projects.

To begin:

  1. Install via PEAR: pear install Net_FTP (requires PEAR to be installed and in include_path)
  2. Or manually include: require_once 'Net/FTP.php'; (after placing Net/FTP.php in your include_path)
  3. Basic usage:
    $ftp = new Net_FTP();
    $ftp->connect('ftp.example.com');
    $ftp->login('user', 'password');
    $ftp->put('remote.txt', 'local.txt'); // upload
    $ftp->get('local_copy.txt', 'remote.txt'); // download
    

Implementation Patterns

  • Legacy wrapper pattern: Replace ad-hoc ftp_*() calls with Net_FTP only to unify syntax in older codebases (e.g., pre-Composer apps).
  • Request-scoped singleton: Instantiate once per request (not per operation) to avoid redundant connections; reuse for batch ops like file sync or config deployment.
  • Error-first control flow: All methods return true/false or PEAR_Error. Always check:
    if (PEAR::isError($result = $ftp->put(...))) {
        $error = $ftp->getError();
        // log or handle
    }
    
  • Passive mode enforcement: Always call $ftp->setPassive(true) before transfers—active FTP is blocked by most firewalls.

Gotchas and Tips

  • No TLS/FTPS support: This package only supports insecure plain FTP. Credentials and data transmit in plaintext. Never use in production without isolation (e.g., internal-only, firewalled networks).
  • PEAR_Error ≠ exceptions: Errors don’t throw exceptions—enable PEAR’s error handling globally (PEAR::setErrorHandling(PEAR_ERROR_DIE)) only in CLI tools, or check manually.
  • PHP 8+ incompatibility: The package is untested on modern PHP. ftp_set_option() usage may break on PHP ≥8.1 due to stricter type checks. Validate on target runtime.
  • Autoloading void: Not PSR-0/4 compatible. Requires manual require_once and correct include_path—conflicts with Composer-based Laravel autoloading.
  • Migration path: To escape legacy dependency:
    • Replace with PHP’s native ftp_connect()ftp_* for trivial cases
    • For robustness: Use league/flysystem + league/flysystem-ftp (and migrate to league/flysystem-ftp-secure for TLS)
    • Audit all FTP usage for SFTP replacement—always preferred for security.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport