1. Go to this page and download the library: Download harshaaliaschinna/ping library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
harshaaliaschinna / ping example snippets
'providers' => [
// Other service providers...
Harshaaliaschinna\Ping\PingServiceProvider::class,
],
// Ping::setId(from_id)->send(to_id, message);
Ping::setId(1)->send(2, "Hello, How are you?");
Ping::setId(1);
Ping::send(2, "Hello, How are you?");
namespace App\Controllers;
..
use Ping;
class Demo extends Controller {
public function __construct() {
// Ping once initialized it can be used anywhere without setting From Id.
Ping::setId(Auth::Id());
}
public function sendMessage($toId, $message) {
..
..
Ping::send($toId, $message);
..
}
public function retriveMessage($Id) {
..
$markAsSeen = true; // Bool
$message = Ping::recieve($Id, $markAsSeen);
..
}
..
..
..
}
object setId( int $id )
object send( int $to_id, string $message)
object new( int $user_one[, int $user_two = null])
bool exists( int $user_two)
object receive( int $message_id[, $seen = false])
object receiveAll( int $connection_id[[[[, bool $seen = false], string $order = 'ASC'], int $skip=null], int $take=null])
object totalConnections([int $user_id=null])
int unreadCount( int $connection_id[, int $user_id=null])
bool markAsSeen( int $message_id)
bool markUnreadAsSeen( int $conection_id[, int $user_id = null])
bool hasAccess( int $connection_id[, int $user_id = null])
bool delete( int $message_id[, int $user_id=null])