web-push-php | Web Push library for PHP | Notification library

 by   web-push-libs PHP Version: v8.0.0 License: MIT

kandi X-RAY | web-push-php Summary

kandi X-RAY | web-push-php Summary

web-push-php is a PHP library typically used in Messaging, Notification, Symfony applications. web-push-php has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Web Push library for PHP. WebPush can be used to send notifications to endpoints which server delivers Web Push notifications as described in the Web Push protocol. As it is standardized, you don't have to worry about what server type it relies on.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              web-push-php has a medium active ecosystem.
              It has 1506 star(s) with 271 fork(s). There are 84 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 56 open issues and 206 have been closed. On average issues are closed in 83 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of web-push-php is v8.0.0

            kandi-Quality Quality

              web-push-php has 0 bugs and 0 code smells.

            kandi-Security Security

              web-push-php has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              web-push-php code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              web-push-php is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              web-push-php releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              It has 837 lines of code, 67 functions and 8 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed web-push-php and discovered the below as its top functions. This is intended to give you an instant insight into web-push-php implemented functionality, and help decide if they suit your requirements.
            • Prepares the notifications .
            • Decrypt a message to deterministic .
            • Get VAP ID header .
            • Validate the public key .
            • Flushes all messages .
            • Calculate the agreement key
            • Create an instance from an associative array .
            • Unserialize a public key .
            • Serialize a public key .
            • Serialize the subscription .
            Get all kandi verified functions for this library.

            web-push-php Key Features

            No Key Features are available at this moment for web-push-php.

            web-push-php Examples and Code Snippets

            No Code Snippets are available at this moment for web-push-php.

            Community Discussions

            QUESTION

            POST https://kayaindia.in/kaya/sendNotificationB.php 500 (Internal Server Error)
            Asked 2019-Jul-16 at 08:00

            I an creating a PWA app and its working fine, but when I tried to upload on server I stuck on error. On windows local server, everything is fine even notifications, and I dont know much putty/linux commands.

            check here my phpinfo file.

            I am tring to upload to amazon ec2 server. I installed apache, php, ssl and other required things. And its working file except notifications.

            When I call my notification file, I got 503 response. I installed composer, installed everything. I used this github library.

            As I understand, I stuck on gmp extension, When I open phpinfo() I didnt see gmp over there. I installed gmp using sudo yum install php-gmp and also I see a file in php.d named as 20-gmp.ini and it included extension=gmp. Also restarted apache server using sudo apachectl stop, sudo apachectl start.

            But still I am getting error. And I coudnt see gmp in phpinfo().

            notificationb.php

            ...

            ANSWER

            Answered 2019-Apr-27 at 09:38

            I know I am commenting my own question, As I was searching this answer for 3-4 days I think I should share this info with everyone.

            The issue is, In linux, PHP have different-different configuration files. The main configuration file is php.ini. And it include other extensions after loading this file and override mail file. These additional configuration are located in /etc/php.d/ (in my case, which is common for mostly).

            So just restarting apache server in not enough. We need to also restart php-fpm.

            To restart php-fpm: sudo service php-fpm restart And then restart apache: sudo apachectn restart

            You can check more here

            Source https://stackoverflow.com/questions/55862087

            QUESTION

            Web Notifications custom implementation vs third-party services
            Asked 2019-Mar-22 at 13:02

            I need to implement web notifications for some website and send notifications from php script executed in console.

            I found that is possible to implement web notifications without using third-party services, by using this lib https://github.com/web-push-libs/web-push-php Here is good tutorial https://web-push-book.gauntface.com/

            But there also are some third-party services that provides sending web notifications, like:

            https://onesignal.com/webpush https://pushalert.co/ https://pushpad.xyz/

            and others.

            1 - What benefits from using this third party services ?

            2 - Is there some limitations when this feature is implemented without using these third-party services ?

            3 - How third-party services send notifications, are they using they own push service ?

            ...

            ANSWER

            Answered 2019-Mar-22 at 13:02

            1 - What benefits from using this third party services ? - you don't have to manage the service. - You Don't have to work on modifications, if there is any update in backends. - You don't have to actually look for cross browser issues. - Easy to implement - You will get Reporting along with this (few gives)

            2 - Is there some limitations when this feature is implemented without using these third-party services ? - Limitation will be on membership level, If you choose highest paid membership then there will no limitations attached.

            3 - How third-party services send notifications, are they using they own push service ? - They Have their managed backends and for frontends they use the same JS function but well written and optimized.

            Source https://stackoverflow.com/questions/54659570

            QUESTION

            Web-Push notification script working on Firefox but not on Chrome
            Asked 2018-Dec-29 at 07:53

            I am building a web push notification system and I am using the concept used in this example:

            https://github.com/Minishlink/web-push-php-example

            I have the following code in my JS file. It checks for API support, checks if notifications are not disabled, registers the service worker, asks for permission to display notifications, if allowed subscribes the user and sends the details to the server. If the user is already subscribed, it updates the endpoint value in the DB.

            When I run this on Firefox 61, it works fine, but when I run it on Chrome 67 I get this error:

            ...

            ANSWER

            Answered 2018-Jul-13 at 09:08
                    if(subscription){
            const key = subscription.getKey('p256dh');
                        const token = subscription.getKey('auth');
                        const contentEncoding = (PushManager.supportedContentEncodings || ['aesgcm'])[0];
            
                        return fetch('/scripts/notification-subscribe.php', {
                            method: 'POST',
                            body: JSON.stringify({
                                endpoint: subscription.endpoint,
                                publicKey: key ? btoa(String.fromCharCode.apply(null, new Uint8Array(key))) : null,
                                authToken: token ? btoa(String.fromCharCode.apply(null, new Uint8Array(token))) : null,
                                contentEncoding,
                                user: 1,
                            }),
                        }).then(() => subscription);
                    }
            }
            
            Just modify this function hope pushSubscription with if block it works
            

            Source https://stackoverflow.com/questions/51320319

            QUESTION

            Web Push php libriary : Throws internal error
            Asked 2018-Sep-21 at 12:25

            I used the web push library to send push notifications https://github.com/web-push-libs/web-push-php

            I getting an internal error while trying to sen push notification

            I checked in both PHP version:7.1.22,7.2.9-1
            Apache error log throws :

            [:error][client ::1:33302] PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php on line 41, referer: http://localhost/PWA/web-push-php-example/src/

            And i also tried in Ngnix / error log :

            17:22:36 [error] 20232#20232: *46 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: endpoint in /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php on line 69 PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Minishlink\WebPush\Subscription::__construct() must be of the type string, null given, called in /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php on line 72 and defined in /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php:39 Stack trace: thrown in /var/www/html/PWA/web-push-php-example/vendor/minishlink/web-push/src/Subscription.php on line 39" while reading response header from upstream, client: 127.0.0.1, server: local.pwa.com, request: "POST /PWA/web-push-php-example/src/send_push_notification.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "localhost", referrer: "https://localhost/PWA/web-push-php-example/src/"

            PHP code :

            ...

            ANSWER

            Answered 2018-Sep-21 at 11:13

            Are you absolutely sure you are actually running PHP 7.21 or 7.2? The problem is the question marks in the constructor here:

            https://github.com/web-push-libs/web-push-php/blob/master/src/Subscription.php#L41-L43

            As you can see from this 3v4l code, it works on all versions over 7.1:

            Source https://stackoverflow.com/questions/52441721

            QUESTION

            Web Push Notification: How to use Web Push PHP Library?
            Asked 2018-Sep-04 at 09:30

            I Want to add Web Notification to my website. I searched on Google and found some tutorials about it. As described in these tutorials I manage to show subscription box to the visitors and I can store their data also.

            Main.js

            ...

            ANSWER

            Answered 2017-Jun-15 at 20:01

            Take a look at https://web-push-book.gauntface.com/ for a general introduction to Web Push. The Chapter How Push Works and Subscribing a User should be particularly interesting to you. In summary:

            • At the client side you need to create a subscription by calling pushManager.subscribe. More info here.
            • You should send this subscription to your server. For example, make an AJAX request to send the subscription (endpoint, keys.p256dh, keys.auth) to the server. More info here.
            • On the server you send a push message using the PHP Web Push library. First, you need to configure this library with your keypair. Then, you need to use the subscription (endpoint, keys.p256dh, keys.auth) to send a push message. More info here.

            Source https://stackoverflow.com/questions/44474960

            QUESTION

            Push notifications in PHP. How to use it?
            Asked 2017-Jun-08 at 07:12

            i would like to send push notification in PHP, but i don't know how to do.

            I successfully create the Service Worker.

            I took a key from this page https://web-push-codelab.appspot.com/. But i don't understand why do they give a private key ?

            Then i test my push notifiaction, and i send some notification from this page. But I would like to send push notification from my PHP request. More, i would this work on all the bowsers possible, this code works just with google chrome. Can we do this with firefox, safari, opéra ?

            I already use the librairie web-push-php. (avaible here: https://github.com/web-push-libs/web-push-php) I copy/pase the code from the documentation, and i remplace my key, and messages:`

            ...

            ANSWER

            Answered 2017-Jun-07 at 20:44

            I took a key from this page https://web-push-codelab.appspot.com/. But i don't understand why do they give a private key ?

            The server is supposed to generate a public/private keypair. The public key is used by the browser to create a subscription. The private key remains on the server and is used to encrypt the push message.

            And i would like also target the notifications. I would like to send the notification like "xxx commented to your post" or "xxx liked to your post" or "xxx send to you a friend request"

            At some point you have the browser register a subscription by calling pushManager.subscribe (but this code is missing from your question). This returns a promise that resolves to a subscription. You should associate this subscription to the currently authenticated user. For example, you can use AJAX to send the subscription to your server and store it with the currently authenticated user. Whenever you want to notify this user you can use the subscription that is associated with this user.

            You might want to take a look at https://web-push-book.gauntface.com/.

            Source https://stackoverflow.com/questions/44422199

            QUESTION

            Use third party composer packages in TYPO3 extensions
            Asked 2017-Mar-16 at 09:46

            I have integrated a Service Worker for receiving Push Notifications in my TYPO3 Extension.

            Now I want so send Messages form backend to the clients web-push-php Library.

            But how it is possible to integrate the library and its dependencies to TYPO3?

            ...

            ANSWER

            Answered 2017-Mar-15 at 09:50

            If you set up your project with composer you can just require minishlink/web-push and start using class Minishlink\WebPush\WebPush.

            In case you‘re running in "legacy" mode (i.e. classic install without composer) or want to support both you‘ll need a different approach. IMO best practice is bundling composer requirements in .phar files - this way you can keep your IDE clean and your VCS footprint small. There‘s a blog post with a detailed description about phar bundling in TYPO3 extensions. This method works for most composer requirements following PSR-0 or PSR-4 and should be viable in your case as minishlink/web-push seems to follow PSR-4.

            You can even advance this by using scripts you can launch by running composer run

            Source https://stackoverflow.com/questions/42805442

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install web-push-php

            Use composer to download and install the library and its dependencies.

            Support

            Disable mbstring.func_overload in your php.ini.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/web-push-libs/web-push-php.git

          • CLI

            gh repo clone web-push-libs/web-push-php

          • sshUrl

            git@github.com:web-push-libs/web-push-php.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Notification Libraries

            push.js

            by Nickersoft

            server

            by gotify

            fsnotify

            by fsnotify

            noty

            by needim

            gorush

            by appleboy

            Try Top Libraries by web-push-libs

            web-push

            by web-push-libsJavaScript

            web-push-csharp

            by web-push-libsC#

            webpush-java

            by web-push-libsJava

            pywebpush

            by web-push-libsPython

            encrypted-content-encoding

            by web-push-libsPython