If anyone has anything adequate about php, then leave it here.
Especially interesting is the solution that makes tdjson.so work under apache.
Later here will be PHP
Probably many people want to know who is Preston?
Please connect tdjson to apache and I'll tell you.
There is already some kind of meat https://github.com/tdlib/td/issues/23
But we still have not found out who is such a Preston and how to work with the loop correctly..
Hey. You already wrote about #23. And there I already wrote about the extension. For the year we have grown a bit. Together with @maxvgi we corrected a lot of things, added a stubs for IDE, and there are also some things for a Symfony. Can this be considered adequate? =) I know still a lot of work. So if somobody is interesting - PR is welcome! =)
Nice work, @yaroslavche! I'll expand section about phptdlib in example/README.md.
It seems that there is plenty of room for improvement still. For example, it's odd, that you need to manually call json_encode for each query, or example asks to comment and uncomment code back and forth.
@levlam thanks for those kind words =)
Yeah, I agree. Good points.
JsonClient::query JsonClient.cpp#L85 (and other similiar) expects the first argument to be a string with valid json. But nothing prevents from overriding the method query that will accept the array, or @type, and the rest of the parameters and translate it into a valid json (as I did in bundle for symfony). Honestly, I think this is not task for extension, but maybe I'm wrong and use array is better idea =) setAuthenticationPhoneNumber request, we still do not have the code and we cannot call checkAuthenticationCode. Exactly as we don't need to set the number again when check received code.But thanks for the comments, I will definitely consider this moments =)
updateAuthorizationState as described in Getting Started. By handling this update application always knows, whether it needs to call setAuthenticationPhoneNumber or checkAuthenticationCode. There are a lot of tricky cases, so you can never be sure that after restart you don't need to enter phone number again or that you need to enter a code, and not a password.Yes, I know about this. You can check TDLibService::checkReceivedResponses. There in all received responses i check updateAuthorizationState and set authorizationState property. After this, I just check state in controller and show forms if it needed:
public function getAuthorizationState(): ?Response
{
$authorizationState = $this->tdlibService->getAuthorizationState();
if ($authorizationState === TDLibService::AUTHORIZATION_STATE_READY) {
// ok
}
switch ($authorizationState) {
case TDLibService::AUTHORIZATION_STATE_WAIT_PHONE_NUMBER:
return $this->showPhoneNumberForm();
case TDLibService::AUTHORIZATION_STATE_WAIT_CODE:
return $this->showAuthenticationCodeForm();
default:
return null;
}
}
This is not good at all. Just for an example =)
Good example. It remains to implement interface. (The Interface Segregation Principle)
Probably need to look for an autogeneration mechanism similar to this: https://github.com/egramtel/tdsharp/blob/master/TDLib.Api/Functions/BlockUser.cs
Hi. I had some free time and an idea how to work with tdlib json client via WebSocket in PHP. Sounds weird? xD I know, but.. Maybe someone will find this useful. The idea is: you can run ws server with json client inside as symfony console application and just interact with it. And yes, as always, there is still a lot of work =)
You can see example in readme here. And there is a screenshot:

But it is not necessary to add this package, as it is just experimental right now. It will be enough to require symfony/console and add classes for the server and the command (see command in package).
Sorry for littering a closed issue with inappropriate information. I just wanted to share, and I did not find a better place =)
You can also interact directly from Vue without escaping to "server proxies".
It remains to untie TDLib from Telegram.
Most helpful comment
Hi. I had some free time and an idea how to work with tdlib json client via WebSocket in PHP. Sounds weird? xD I know, but.. Maybe someone will find this useful. The idea is: you can run ws server with json client inside as symfony console application and just interact with it. And yes, as always, there is still a lot of work =)

You can see example in readme here. And there is a screenshot:
But it is not necessary to add this package, as it is just experimental right now. It will be enough to require
symfony/consoleand add classes for the server and the command (see command in package).Sorry for littering a closed issue with inappropriate information. I just wanted to share, and I did not find a better place =)