mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-30 04:19:13 +01:00
Update for use in external projects via composer.
This commit is contained in:
parent
d1f314bba5
commit
614ca2dc11
@ -1,9 +1,14 @@
|
||||
<?php
|
||||
//Check if autoload has been already loaded (in case plugin installed in existing project)
|
||||
$root = __DIR__;
|
||||
if (!class_exists('TelegramSwooleClient')) {
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
if (!file_exists($root . '/vendor/autoload.php')) {
|
||||
$root = __DIR__ . '/../../..';
|
||||
}
|
||||
require $root . '/vendor/autoload.php';
|
||||
chdir($root);
|
||||
}
|
||||
//Check if root env file hash been loaded (in case plugin installed in existing project)
|
||||
if (!getenv('SWOOLE_SERVER_ADDRESS')){
|
||||
(new Dotenv\Dotenv(__DIR__))->load();
|
||||
(new Dotenv\Dotenv($root))->load();
|
||||
}
|
||||
|
@ -41,5 +41,5 @@ Example:
|
||||
exit;
|
||||
}
|
||||
|
||||
$client = new \TelegramSwooleClient\Client();
|
||||
$client = new \TelegramSwooleClient\Client($root);
|
||||
new TelegramSwooleClient\Server($client, $options);
|
@ -11,9 +11,9 @@ class Client {
|
||||
/**
|
||||
* Client constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($root)
|
||||
{
|
||||
$sessionFile = __DIR__ . '/../session.madeline';
|
||||
$sessionFile = $root . '/session.madeline';
|
||||
|
||||
$config = Config::getInstance()->getConfig('telegram');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user