ekongyun / php-coap
coap framework
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
pkg:composer/ekongyun/php-coap
Requires
- react/react: 0.4.*
This package is auto-updated.
Last update: 2025-12-12 08:13:51 UTC
README
Asynchonous Coap client and server in PHP
Example Client
<?php $loop = React\EventLoop\Factory::create(); $client = new PhpCoap\Client\Client( $loop ); $client->get( 'coap://skynet.im/status', function( $data ) { var_dump( json_decode( $data )); } ); $loop->run(); ?>
Example Server
<?php $loop = React\EventLoop\Factory::create(); $server = new PhpCoap\Server\Server( $loop ); $server->receive( 5683, '0.0.0.0' ); $server->on( 'request', function( $req, $res, $handler ) { $res->setPayload( json_encode( 'test' ) ); $handler->send( $res ); }); $loop->run(); ?>
Notes & ToDo's
- TODO: Implement message tokens (only Message Id's currently used)
- Only single packet messages are supported currently
- TODO: Create message router for server component
Credits
This component leverages the patterns and components from the ReactPhp.