PHP code example of ikerlin / laravel-wechat-jssdk

1. Go to this page and download the library: Download ikerlin/laravel-wechat-jssdk 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/ */

    

ikerlin / laravel-wechat-jssdk example snippets


use WechatDev\WechatJSSDK;

Route::get('/', function () {
	//default
	$signPackage = WechatJSSDK::set("your_appid","your_appsecrect")->getSignPackage();
	
	//or specify share link
	$signPackage = WechatJSSDK::set("your_appid","your_appsecrect")
		->setShareLink('https://google.com')
		->getSignPackage();
		
	//or add protocol and hostname automatically
	$signPackage = WechatJSSDK::set("your_appid","your_appsecrect")
		->setShareLink('/test',true) //https://hostname/test
		->getSignPackage();
		
	return view('welcome',["signPackage"=>$signPackage]);
});