New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

avto-dev/huawei-push-kit

Simple Huawei Push in PHP
4,294
Install
composer require avto-dev/huawei-push-kit
Latest Version:v0.4.0
PHP:^8.3
Laravel:11 · 12 · 13
License:MIT
Last Updated:Aug 13, 2026
Links: GitHub  ·  Packagist
Maintainer: eldario

Huawei Push Kit PHP

[!IMPORTANT] This is a replacement for a afiqiqmal/huawei-push package that is currently not being updated.

Installation

composer require avto-dev/huawei-push-kit

Usage

Get Access Token

References : Huawei OAuth

$access = HuaweiPushKit::make([
    'app_id' => 'YOUR APP ID',
    'client_secret' => 'YOUR CLIENT SECRET'
])
    ->getAccessToken();


//Laravel
$access = HuaweiPushKit::make(config('huawei'))->getAccessToken();
$access = app(HuaweiPushKit::class)->getAccessToken();

Response

{
    "access_token": "ACCESS TOKEN",
    "expires_in": 3600,
    "token_type": "Bearer"
}
Push Message

References : Huawei Push Kit

$response = HuaweiPushKit::make([])
    ->withAccessToken('ACCESS TOKEN')
    ->push(
        NotificationPayload::make()
            ->setValidateOnly(false)
            ->setMessage(
                Message::make()
                    ->setNotification(
                        Notification::make()
                            ->setTitle("Testing Title")
                            ->setBody("Body")
                            ->setImage("https://seeklogo.com/images/L/laravel-logo-41EC1D4C3F-seeklogo.com.png")
                    )
                    ->setAndroid(
                        Config::make() // AndroidConfig
                            ->setUrgency(2)
                            ->setCategory(1)
                            ->setTimeToLive(3360)
                            ->setTags('TrumpIsDown')
                            ->isStaging(true)
                            ->setNotification(
                                AndroidNotification::make() // Notification
                                    ->setClickAction(
                                        ClickAction::make()
                                        ->setType(1)
                                        ->setIntent("pushscheme://com.huawei.hms.hmsdemo/deeplink?#Intent;i.isFeed=1;S.feedDocId=0LauP4X6;end")
                                        ->setUrl('https://www.google.com')
                                    )
                                    ->setImage('https://seeklogo.com/images/L/laravel-logo-41EC1D4C3F-seeklogo.com.png')
                                    ->setIcon('/raw/ic_launcher2')
                                    ->setColor('#FFFFFF')
                                    ->setSound('/raw/shake')
                                    ->setDefaultSound(false)
                                    ->setPriority(3)
                                    ->setChannelId("HMSTestDemo")
                                    ->setAutoClear(100000) // ms
                                    ->setSummary("Summary")
                                    ->setStyle(0)
                                    ->setNotifyId(123456)

                                    ->setButtons([
                                        Button::make()->setName("Home")->setActionType(0)
                                    ])
                            )
                    )
                    ->setTopic("Topic")
            )
    );

Response

{
    "code": "80000000",
    "msg": "Success",
    "requestId": "160502268063038626000406"
}

TODO

  • WebPUSH
  • APNS

License

Licensed under the MIT license

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v0.4.0 ^8.3 ^11.34 | ^12.0 | ^13.0 MIT
v0.3.0 ^8.3 ^11.34 | ^12.0 MIT
v0.2.2 ^8.3 ^11.34 MIT
v0.2.1 ^8.3 ^11.34 MIT
v0.2.0 ^8.3 ^11.34 MIT