PHP code example of moorper / serverchan

1. Go to this page and download the library: Download moorper/serverchan 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/ */

    

moorper / serverchan example snippets


use Moorper\ServerChan;

$client = new Client('sckey');
$client->send('text','desp');



namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Moorper\ServerChan\Client;

class ServerChanProvider extends ServiceProvider
{
    /**
     * Bootstrap services.
     */
    public function boot()
    {
    }

    /**
     * Register services.
     */
    public function register()
    {
        $this->app->singleton('ServerChan', function () {
            return new Client('SCU24500T3ef124dd328fe4fc372925e708aa21a35acb04e70a274');
        });
    }
}



namespace App\Facades;

use Illuminate\Support\Facades\Facade;

class ServerChan extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'ServerChan';
    }
}