Arne-van-der-Lei / chatter-bot-api

Automatically exported from code.google.com/p/chatter-bot-api
0 stars 0 forks source link

PHP version of the library #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What about a PHP version of this library ?

I you want it, please STAR this issue.

Please, also, let me know what you think about:
- the PHP version I should support?
- if I use or not some dependencies (like curl for example)?

Original issue reported on code.google.com by pierredavidbelanger@gmail.com on 21 Sep 2011 at 11:59

GoogleCodeExporter commented 9 years ago

Original comment by pierredavidbelanger@gmail.com on 27 Sep 2011 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by pierredavidbelanger@gmail.com on 27 Sep 2011 at 9:15

GoogleCodeExporter commented 9 years ago
PLEASE MAKE A PHP! PLEASE!

Original comment by t...@tobischweiger.com on 23 Oct 2011 at 8:27

GoogleCodeExporter commented 9 years ago
a PHP port wouild be tremendous or at least documentation of the API so we 
could write our own...

Original comment by andrewmo...@gmail.com on 8 Nov 2011 at 10:21

GoogleCodeExporter commented 9 years ago
I have given some thought on this issue.

You should know that given the stateless nature of PHP (request/response), this 
library in PHP will not work as expected.

Let me explain:

Take those lines of C# code for example:

ChatterBotFactory factory = new ChatterBotFactory();
ChatterBot bot1 = factory.Create(ChatterBotType.CLEVERBOT);
ChatterBotSession bot1session = bot1.CreateSession();
s = bot1session.Think(s);
s = bot1session.Think(s);

For this library to work, the same instance of ChatterBotSession (bot1session) 
should be reuse for each call to bot1session.Think(s), because a state (like a 
Cleverbot session id for example) is stored into the ChatterBotSession 
(bot1session) instance.

SO, in PHP, you will need to create only one ChatterBotSession instance per 
user session, then reuse this instance in each of your requests/response. To 
acheive this you will probably need to use the serialize 
(http://php.net/manual/en/function.serialize.php) function to make a string out 
of the ChatterBotSession, then storing it in a DB or something (user sesssion 
may be). Otherwise a new conversation (a new Cleverbot session) will be created 
in each request/response, wich is not what you want.

You really need to understand this before you use the PHP version of this 
library.

That being said, I will start working on this issue soon.

Please let me know what you think, I need some feedbacks.

Original comment by pierredavidbelanger@gmail.com on 9 Nov 2011 at 3:31

GoogleCodeExporter commented 9 years ago
Ok guys, I am starting this!

Original comment by pierredavidbelanger@gmail.com on 10 Nov 2011 at 1:54

GoogleCodeExporter commented 9 years ago
Ok, it is done guys (in r18)!

You can now download chatterbotapi.php version 1.1 here:

http://code.google.com/p/chatter-bot-api/downloads/detail?name=chatterbotapi.php
-1.1.zip

Check the home page (http://code.google.com/p/chatter-bot-api/) for a PHP 
example.

Original comment by pierredavidbelanger@gmail.com on 10 Nov 2011 at 4:10

GoogleCodeExporter commented 9 years ago
Ok, it is done guys (in r18)!

You can now download chatterbotapi.php version 1.1 here:

http://code.google.com/p/chatter-bot-api/downloads/detail?name=chatterbotapi.php
-1.1.zip

Check the home page (http://code.google.com/p/chatter-bot-api/#PHP) for a PHP 
example.

Original comment by pierredavidbelanger@gmail.com on 10 Nov 2011 at 4:11