marwanlotfy / blink
Blink, An API chat package integrate with your laravel application
Requires
- php: ^7.3
- illuminate/support: ^8.10
This package is auto-updated.
Last update: 2024-04-29 04:28:13 UTC
README
Hii , Blink is a chat package integerate with laravel
it's easy to install , provides you with apis for chats,messages,message informations and support messages of type (text , images , voice , location and video )
Features
- Restful APIs for Chat (create , list)
- Restful APIs for Message (create , list , get sended media)
- Supported Message Types (Audio , Video , Images , Text , Location )
- Restful APIs for Message Info ( list , seen , deliverd )
Installation
You can install the package via composer:
composer require marwanlotfy/blink
Usage
php artisan migrate
You need to publish config file and override the defaults options
php artisan vendor:publish --tag=blink-config
try
php artisan route:list
it will list chat routes for you
if you need your users hasChats you can use HasChats Trait
use Blink\HasChats;
on your UserModel
and add
use HasChats;
inside User class
properties Added are
$user->chats; $user->unBannedChats; $user->bannedChats;
methodes Added are
$user->leaveChat($chatId);
you can use Blink Facade
use Blink\Facades\Blink; Blink::createChat(...$usersIds); Blink::getChat($chatId)->delete(); Blink::getChat($chatId)->createTextMessage(String $body); Blink::getChat($chatId)->unSuspend(); Blink::getChat($chatId)->suspend(); Blink::getChat($chatId)->banUsers(...$users); Blink::getChat($chatId)->unBanUsers(...$users); Blink::getChat($chatId)->markAsGroup($creatorId,$groupName,$description,$icon)->makeGroupAdmin(...$users);
You can keep adding admins to chat if is marked as Group
when you create chat there is an event will be fired
Blink\Events\NewChatCreated
so you can listen on this event and handle the logic you want to notify your users
the event has $chat property
when you send chat Message there is an event will be fired
Blink\Events\NewChatMessage
so you can listen on this event and handle the logic you want to notify your users that new message created
the event has $message property
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email marwandevelop@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.