Chapter 1. Introduction

Table of Contents

1.1. Who should use phpseclib
1.2. Using phpseclib

1.1. Who should use phpseclib

Although many of the features this library implements are implemented in PHP via optional extensions, what are you, as a developer, going to do when a user tries to run your software on a host which, coincidentally, doesn't happen to have that optional extension installed? You could, flat-out, tell that user to look for another software package that does work on their server (or to get another host, or whatever), which is liable to leave a bad impression on the user, or you could use a library like this - a library that uses those optional extensions if they're available and falls back on an internal PHP implementation if they're not.

Another advantage of using this library over optional PHP extensions is that you, as a developer, may find this libraries API easier to use then extensions API.

1.2. Using phpseclib

This library is written using the same conventions that libraries in the PHP Extension and Application Repository (PEAR) have been written in. In particular, this library expects to be in your include_path:

<?php
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');

include('Net/SSH2.php');
?>