PHPackages                             muran2/laravel-huawei-push-php81-lara9 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. muran2/laravel-huawei-push-php81-lara9

ActiveLibrary

muran2/laravel-huawei-push-php81-lara9
======================================

Huawei Push SDK for Laravel 9 and php 8.1

2.0.0(3y ago)0573MITPHPPHP ^8.1

Since Sep 30Pushed 3y agoCompare

[ Source](https://github.com/muran2/laravel-huawei-push-php8.1)[ Packagist](https://packagist.org/packages/muran2/laravel-huawei-push-php81-lara9)[ Docs](https://github.com/n2boost/laravel-huawei-push)[ RSS](/packages/muran2-laravel-huawei-push-php81-lara9/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Huawei Push SDK for Laravel
===========================

[](#huawei-push-sdk-for-laravel)

This package offers huawei push service tools.

Here are some push examples:

```
$push = new HuaweiPush();

$title = 'APP Name';
$message = 'This is a Message, Click Me!';

$accessToken = $push->getAccessToken(); // 获取AccessToken 可以保存起来
$data = [
		'type' => 'scheme',
		'data' => "app://www.app.com/activity?id=123456789"
];

$push = $push->setTitle($title)
		->setMessage($message)
		->setAccessToken($accessToken)
		->setCustomize($data);

$push->addDeviceToken("aBX471FWGHmiYZbZyE7o8WWISWYYQuVTEkJIbChBomv6mH3RWiTVOCDtJ-Hc-_E5rMPXzzIVjexXQHbN1GKmLhJqKqxJ4E86MyoUvw");
$push->sendMessage(); // 执行推送消息。

dump($push->isSendSuccess()); // 是否推送成功
dump($push->isSendFail()); // 是否推送失败
dump($push->getAccessTokenExpiresTime()); // 获取 AccessToken 过期时间
dump($push->getSendSuccessRequestId()); // 获取推送成功后接口返回的请求 id
```

Requirements
------------

[](#requirements)

This package requires Laravel 5.5 or higher, PHP 7.0 or higher.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require n2boost/laravel-huawei-push:dev-master
```

The package will automatically register itself.

You can optionally publish the config file with:

```
php artisan vendor:publish --provider="N2boost\LaravelHuaweiPush\HuaweiPushServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
