定制 cloudlog/laravel-appstore-server-notifications 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cloudlog/laravel-appstore-server-notifications

Composer 安装命令:

composer require cloudlog/laravel-appstore-server-notifications

包简介

Handling Appstore server to server notifications

README 文档

README

Latest Version on Packagist Build Status StyleCI Scrutinizer Code Quality Total Downloads

Installation

You can install this package via composer

composer require cloudlog/laravel-appstore-server-notifications 

The service provider will register itself. You have to publish the config file with:

php artisan vendor:publish --provider="Appvise\AppStoreNotifications\NotificationsServiceProvider" --tag="config" 

This is the config that will be published.

return [
    /*
     * Apple will send the shared secret with the request that should match
     * the one you use when validating receipts.
     * https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_server-to-server_notifications?language=objc#overview
     */
    'shared_secret' => env('APPLE_SHARED_SECRET'),
    /*
     * All the events that should be handeled by your application.
     * Typically you should uncomment all jobs
     *
     * You can find a list of all notification types here:
     * https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_server-to-server_notifications?language=objc#3162176
     */
    'jobs' => [
        // 'initial_buy' => \App\Jobs\AppstoreNotifications\HandleInitialBuy::class,
        // 'cancel' => \App\Jobs\AppstoreNotifications\HandleCancellation::class,
        // 'renewal' => \App\Jobs\AppstoreNotifications\HandleRenewal::class,
        // 'interactive_renewal' => \App\Jobs\AppstoreNotifications\HandleInteractiveRenewal::class,
        // 'did_change_renewal_pref' => \App\Jobs\AppstoreNotifications\HandleDidChangeRenewalPreferences::class,
        // 'did_change_renewal_status' => \App\Jobs\AppstoreNotifications\HandleDidChangeRenewalStatus::class,
    ],
];

The shared secret should match the one you send to the store to validate receipts

This package logs all the incoming requests to the database so these steps are mandatory:

php artisan vendor:publish --provider="Appvise\AppStoreNotifications\NotificationsServiceProvider" --tag="migrations"

You should run migrate next to create the apple_notifications table:

php artisan migrate

This packages registers a POST route (/apple/server/notifications) to the Webhookscontroller of this package

Usage

When there is an change in one of the subscriptions Apple will send a POST request to a configured endpoint. Follow this guide to configure the endpoint:

This package will send a 200 response if you configured the right Job for the right Notification Type otherwise it will send a 500 back to Apple. Apple will retry a couple of times more. The incoming payload is stored in the apple_notifications table.

Handling incoming notifications via Jobs

<?php

namespace App\Jobs\AppstoreNotifications;

use App\Jobs\Job;
use Appvise\AppStoreNotifications\Model\NotificationPayload;

class HandleInitialBuy extends Job
{
    public $payload;

    public function __construct(NotificationPayload $payload)
    {
        $this->payload = $payload;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        // Do something that matches your business logic with $this->payload
    }
}

Changelog

Please see CHANGELOG for more information about what has changed recently.

Testing

composer test

Security

If you discover any security related issues, please email daan@app-vise.nl instead of using the issue tracker.

Credits

A big thanks to Spatie's laravel-stripe-webhooks which was a huge inspiration and starting point for this package

License

The MIT License (MIT). Please see License File for more information.

cloudlog/laravel-appstore-server-notifications 适用场景与选型建议

cloudlog/laravel-appstore-server-notifications 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.67k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel-appstore-server-to-server-notifications」 「laravel-appstore-server-notifications」 「laravel in app subscriptions」 「cloudlog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cloudlog/laravel-appstore-server-notifications 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cloudlog/laravel-appstore-server-notifications 我们能提供哪些服务?
定制开发 / 二次开发

基于 cloudlog/laravel-appstore-server-notifications 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-27