Place the PusherWrapper inside your '''App/Services''' directory Place the pusher.php inside your config folder.
Last active
November 17, 2019 20:09
-
-
Save mottihoresh/394e12ea802b41b5ef65 to your computer and use it in GitHub Desktop.
Basic Pusher Integration with Laravel 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'appId' => 'YOUR-APP-ID-HERE', | |
'appKey' => 'YOUR-APP-KEY-HERE', | |
'appSecret' => 'YOUR-APP-SECRET-HERE', | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: mhoresh | |
* Date: 3/7/15 | |
* Time: 4:15 PM | |
*/ | |
namespace App\Services; | |
use Illuminate\Support\Facades\Config; | |
class PusherWrapper { | |
protected $pusher; | |
function __construct() | |
{ | |
$app_id = Config::get('pusher.appId'); | |
$app_key = Config::get('pusher.appKey'); | |
$app_secret = Config::get('pusher.appSecret'); | |
$this->pusher = new \Pusher( $app_key, $app_secret, $app_id ); | |
} | |
public function __call($name, $args) { | |
returncall_user_func_array(array($this->pusher, $name), $args); | |
} | |
} |
Great thanks. You just missed a space in the _call method :
public function __call($name, $args) {
return call_user_func_array(array($this->pusher, $name), $args);
}
Tanks man!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No Idea how to write introduction... but just inject that service anywhere, and you can use it.
for example