midnite81/prowl 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

midnite81/prowl

Composer 安装命令:

composer require midnite81/prowl

包简介

A PHP wrapper for Prowl with a Laravel Integration

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License
A PHP wrapper for using the Prowl API, with a Laravel 5 service provider for integration with Laravel

Installation

This package requires PHP 8.2+, and comes with a Laravel Service Provider and Facade for Laravel integration. Please note, you do not need to have laravel installed to use this package.

To install through composer include the package in your composer.json.

"midnite81/prowl": "^2.0.0"

Run composer install or composer update to download the dependencies or you can run composer require midnite81/prowl.

Http Standards

To adhere to better standards, this package uses the popular and powerful PHP-HTTP library to make HTTP requests. By default a Guzzle adapter is required when using midnite81\prowl. This allows you, should you wish, to use your own HTTP Client instead of Guzzle. For more information on PHP-HTTP, please visit php-http.org

Versioning

Version Description
v4.* Minimum PHP 8.2, PSR-17 request/stream factories, and modernised PHPUnit 11 test suite
v3.* Support added to use Carbon 3 as a dependency
v2.* Completely rewritten from the ground up, with no additional prowl dependencies
v1.* Unsupported - Relied on other prowl packages

Laravel 5 Integration

If you wish to use this package with Laravel, please visit the laravel specific readme.

Standard (Non laravel) implementation

To get started using this Prowl wrapper, you will need to instantiate the prowl class. The construct of the Prowl object takes an array for configuration. If you don't provide one, it will just use default values. In the example below I've provided a sample config.

<?php
use Midnite81\Prowl\Prowl;
include __DIR__ . '../vendor/autoload.php';

/**
 * By default, the package will use Guzzle to process our HTTP requests, but you can use anything that
 * implements the PHP-HTTP standard
 */

$prowl = Prowl::create(['apiUrl' => 'https://api.prowlapp.com/publicapi']); 

There are four main methods on the Prowl class, which identify the main four api calls you can make.

Api Method Prowl Method Description
add $prowl->add(Notification $notification) Sends a push notification to one or more devices
verify $prowl->verify($apiKey, $providerKey) Verifies the api key is valid
retrieve/token $prowl->retrieveToken($providerKey) Get a registration token for use in retrieve/apikey
retrieve/apikey $prowl->retrieveApiKey($providerKey, $token) Get an API Key from a registration token received in retrieve/token

To understand what each of these api calls does, you should check out the documentation at https://www.prowlapp.com/api.php

In order to send a notification to a prowl linked device, you will need to create a Notification object. There are a couple of ways in which to do this. You can either call instantiate a new Notification object or you can call it from the Prowl object. If you call it from the Prowl object the prowl object will be sent to it so you can call the send method via chaining. There are a couple of factory methods on the Notification object should you rather use those.

<?php
use Midnite81\Prowl\Services\Notification;
$notification = new Notification(); 
// or 
$notification = $prowl->createNotification(); 

// Using this method you can chain through to send the message directly.
$prowl = new Prowl($config); 
$prowl->createMessage()
    ->setApiKeys($apiKey)
    ->setDescription('This is the description')
    ->setEvent('This is the event')
    ->setPriority(\Midnite81\Prowl\Services\Priority::NORMAL)
    ->setMessage('This is the message')
    ->setApplication('Application')
    ->send();

Once the notification object is created you can call methods to add to the Object. For example;

$notification->setApiKeys($myKey)
             ->setPriority(0)
             ->setEvent('The Event')
             ->setDescription('The Description')
             ->setApplication('The Application')
             ->setMessage('The Message');

Once the notification has all the parameters it needs you can pass it to the add method to trigger a push notification.

$pushNotification = $prowl->add($notification);

Unless there are any Exceptions thrown you will receive a Response object back. For more information on the response object please view readme-response.md

midnite81/prowl 适用场景与选型建议

midnite81/prowl 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 550 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 midnite81/prowl 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-22