Download the PHP package graze/telnet-client without Composer

On this page you can find all versions of the php package graze/telnet-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package telnet-client

telnet-client

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

A telnet client written in PHP

Install

Via Composer

Usage

Instantiating a client

Use the factory method to return a TelnetClientInterface instance:

Issuing commands

Connect to the remote endpoint using the connect method:

Once connected, the execute method can be used to write $command to the socket:

Responses

Once a command has been sent, the socket is read until a specific sequence is encountered. This is a line ending immediately preceded by either a prompt, or an error prompt. At this point the execute method returns a TelnetResponseInterface object:

A success response object might look like:

Or if the server responded with an error:

Note: responseText and promptMatches are trimmed of line endings.

Client configuration

The client uses the following defaults:

Custom configuration can be passed to the connect method like so:

The client's global $prompt can be temporarily overridden on a per-execute basis:

Complex prompts

Some operations may respond with a more complex prompt. These instances can be handled by using a regular expression to match the prompt. For instance, a server may respond with ERROR n (where n is an integer) when an error condition is encountered. The client could be configured as such:

An error response would look like:

We can take the regex one further by using a named capturing group, this makes the error code easily available to us in the $promptMatches array.

which gives us:

Note: it's important to escape any characters in your regex that may have special meaning when interpreted by preg_match.

Socket settings

For timeouts and more, PHP's socket_set_option is exposed via

See clue/php-socket-raw and socket_set_option for more info.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Inspired by

Based on bestnetwork/Telnet.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of telnet-client with dependencies

PHP Build Version
Package Version
Requires php Version >5.5.0
clue/socket-raw Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package graze/telnet-client contains the following files

Loading the files please wait ....