zarincheg / telegram-bot-dialogs

The extension for Telegram Bot API PHP SDK that allows to implement dialogs in bots
MIT License
40 stars 27 forks source link

[Refactoring] #6

Closed seyfer closed 7 years ago

seyfer commented 7 years ago

The Laravel framework should be separated from the core functionality.

This is plugin for irazasyed/elegram-bot-sdk and this library not require use of Laravel.

Laravel should be an option, not requirement or dependency.

For example

/**
 * Class Dialogs
 * @package BotDialogs
 */
class Dialogs

...

/**
     * @param Api $telegram
     * @param Redis $redis
     */
    public function __construct(Api $telegram, Redis $redis)

Depends on

use Illuminate\Redis\Database as Redis;
use Illuminate\Support\Facades\Config;

Redis and Config should be replaced with independent realization and usage of Illuminate packages should be only an option. It should look like

/**
     * @param ApiInterface $telegram
     * @param RedisInterface $redis
     */
    public function __construct(ApiInterface $telegram, RedisInterface $redis)

In this case developer could use Dialogues in any framework with own implementation of Interfaces.

zarincheg commented 7 years ago

I responded in #5. You right, it would be better to remove dependencies. I'll take care about refactoring a little bit later.

zarincheg commented 7 years ago

Conversation moved to #7