Download the PHP package alexya-framework/sockswork without Composer

On this page you can find all versions of the php package alexya-framework/sockswork. 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 sockswork

SocksWork

Alexya's SocksWork library

Contents

SocksWork

The class \Alexya\SocksWork\SocksWork provides an easy way to connect to a server and send packets.

The constructor accepts as parameter the host of the server, the port and the timeout of the connection. It also accepts as 4th parameter a boolean that indicates if SocksWork should connect to the server once the constructor has finnished or not, by default it's set to true, however if you set it to false you'll need to call the \Alexya\SocksWork\SocksWork::connect method.

Example:

Once the connection has been established you can send anything with the \Alexya\SocksWork\SocksWork::send command that accepts as parameter the binary data to send or an instance of \Alexya\SocksWork\PacketBuilder.

If the parameter is binary data the response will be set to the \Alexya\SocksWork\SocksWork::$response property, if it's a \Alexya\SocksWork\PacketBuilder instance the response will be sent directly to it's property.

The method also accepts a 2nd parameter that is a boolean that indicates wether if SocksWork should wait for the response or not.

Example:

To close the connection simply call the method \Alexya\SocksWork\SocksWork::close and when you want to reconnect call the method \Alexya\SocksWork\SocksWork::connect, to see if SocksWork is already connected use the method \Alexya\SocksWork\SocksWork::isConnected.

PacketBuilder

The class \Alexya\SocksWork\PacketBuilder provides an interface to build packets that will be sent with \Alexya\SocksWork\SocksWork, it also provides methods for reading the response.

The constructor accepts as parameter an object of type \Alexya\SocksWork\IEncoder that will be the encoder to use to write and read the packet (By default it's an instance of \Alexya\SocksWork\Encoders\StringEncoder).

Once the constructor has been called you need to can start adding parameters to the packet by calling the methods of the encoder throw the instanced object.

Example:

You can also extend this class for simplifying the instantation of the object:

The method \Alexya\SocksWork\PacketBuilder::onInstance is executed right after the constructor and receives as parameters the arguments sent to the constructor (without the instance of the encoder).

For example:

The method \Alexya\SocksWork\PacketBuilder::onResponse is executed right after the response has been received.

Encoders

The encoders are the classes that will encode the data that SocksWork will send, they must extend the class \Alexya\SocksWork\Encoder. You can see the available encoders in the namespace \Alexya\SocksWork\Encoders.


All versions of sockswork with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
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 alexya-framework/sockswork contains the following files

Loading the files please wait ....