Bridge Library for PHP

Is it possible to use the bridge library in php?

There is only a python client, but making a php one should be fairly easy. Would you like to contribute? This is the repository: GitHub - arduino/YunBridge

Hi Federico, I'm working on this... Do you think it would be better to connect to REST (http://localhost/data/get .......) or send json directly to json server (localhost:5700)?

json server. there is no authentication layer at that level, whereas the REST api can be password protected or not, depending on user will, and that may make your implementation more complicated, both to write and to use

The library is ready.
Where can i publish it?

Best thing is to make a pull request against GitHub - arduino/YunBridge repository
So you take credit for the implementation and it's easier to track bugs, fixes and changes

I'm sorry Federico,
but i'm quite new in github.
I tried pull request but it tell me "Compare branches to draft a pull request. " and it doesn't let me to go ahead.
Have i to fork "YunBridge" before a pull request or?

Yes: you fork the repo, apply your modification to your fork, add-commit-push to your fork then go to github and make a pull request

OK, i did it!

Would like to give it a try, how do I install the bridgeclient.class.php file? Any other files/changes required?


Works great, uncommented include_path in /etc/php.ini, created folder /php5/includes added bridge client.class.php to this folder.

Thanks again...

FYI, the php bridge files will be stored in


and will be available with the upcoming update of linino

Great news! Any sample code using this for anyone that tried it?
Thanks for the lib!

There is a php example code bundled with library (take a look at YunBridge/bridge/php at master · arduino/YunBridge · GitHub).
Regardind Arduino code you could find examples in this topic:
Using BridgeClient in Python Scripts. - Arduino Yún - Arduino Forum
Have fun!

Thanks @toggio

So i did download the lib/class and the example and tried it out and i get the following message:

Fatal error: Call to undefined function socket_create() in /mnt/sda1/arduino/www/WS_YUN/bridgeclient.class.php on line 31

I have not changed anything on the class or the example. Am i doing something wrong? Maybe i need to install something else?

i did uncomment :
from php.ini and restarted my yun... still not working...

anybody? please help !

ok, i was able to get it to work. I followed steps :

  • installed php5-mod-sockets and php5-mod-json
  • for some reason the include_path in /etc/php.ini, (created folder /php5/includes) doenst work so i changed the line :
    require ("bridgeclient.class.php"); to
    include ("bridgeclient.class.php");

and left the bridgeclient.class.php in the same directory...
If any body else has a better solution, please let me know.

Hello @ all

in the
YunBridge / bridge / php / bridgeclient.class.php
i found

In order to use this class you have to install php5, php5-mod-sockets, php5-mod-json and php5-cgi (or php5-cli)

i dont found php5-mod-sockets, php5-mod-json in the List of available packages.
where can i download this files ?

thanks for help