/tawk-laravel

Tawk.to chat widget for Laravel.

Primary LanguagePHPMIT LicenseMIT

tawk.to for Laravel

Packagist License Latest Stable Version Total Downloads

tawk.to has a lot of integrations, but not for Laravel. This is a tawk.to chat widget for Laravel.

Installation

  1. composer require emotality/tawk-laravel
  2. php artisan vendor:publish --provider="Emotality\TawkTo\TawkToServiceProvider"
  3. Add the following line to your .env file:
TAWKTO_LINK="<your_direct_chat_link>"

Get your key from the Direct Chat Link field from your dashboard


Laravel 5.5+ will use the auto-discovery function but for Laravel 5.4 and lower, you will need to include the service provider & facade manually in config/app.php:

'providers' => [
    ...,
    /*
     * Package Service Providers...
     */
    Emotality\TawkTo\TawkToServiceProvider::class,
    ...,
];

...

'aliases' => [
    ...,
    'TawkTo' => Emotality\TawkTo\TawkTo::class,
];

Usage

Just echo the widget code in your app layout blade inside the body tag:

        ...
        {{ TawkTo::widgetCode() }}
    </body>
</html>

Or, if you don't want to use a config file, you can set your key directly like this:

        ...
        {{ TawkTo::widgetCode('your_direct_chat_link') }}
    </body>
</html>

License

tawk-laravel is released under the MIT license. See LICENSE for details.