Download the PHP package wor/sockets without Composer
On this page you can find all versions of the php package wor/sockets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sockets
About laravel-sockets
This project is a good place to start for developing an application that is requires to retrieve or send data via UDP/TCP Sockets .
Requirements
- PHP >= 7.0
- Laravel >= 5.5
Quick Install
OR
add wor/sockets:"^1.0"
to your require
list in the composer.json
file.
Service Provider & Facade (Optional on Laravel 5.5+)
Register provider and facade on your config/app.php file.
Configuration (Optional)
Debugging Mode
To enable debugging mode, just set SOCKET_DEBUG=true and the package will echo the raw payload being sent and received across Sockets.
IMPORTANT: Please make sure that SOCKET_DEBUG is set to false when your app is on production.
Usage
Basic Usage
-
Add the default socket remote to your .env file
- In Laravel or during a tinker session
Intended Usage
This package is intended to be extended. There are two basic concepts at play here : Sockets & Requests.
Sockets
Sockets are the basic communication layer. They should are meant to be extended to include any frame wrapping or encoding that you may want to use or that the receiving service expects.
They should extend the base Socket class and implement the SocketInterface.
In short you should implement the read & write methods to match your expected I/O.
Requests
Requests are meant to encapsulate an action that is performed. They should match the endpoints provided by the service you're working with. Think of them as database transactions. Once you setup the payload and make the request it performs a write and read on the provided socket and returns a parsed result.
Requests extend the base Request class and implement the RequestInterface.
Then you are free to instantiate new requests and run them against your socket service.
In fact you can take it one step further and create action requests based on your new genetic service request.
Any Issues?
If you discover any errors feel free to report them in the issue tracker.