Giter Site home page Giter Site logo

lkaybob / php-fcm-v1 Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 15.0 60 KB

Implementation of Firebase Cloud Messaging HTTP v1 API in PHP

Home Page: https://packagist.org/packages/lkaybob/php-fcm-v1

License: MIT License

PHP 99.51% Shell 0.49%
fcm php-fcm notifications firebase php

php-fcm-v1's People

Contributors

lkaybob avatar mgcastelberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

php-fcm-v1's Issues

Update .travis.yaml

  • Remove PHP 5.6
    • About a year has passed, since PHP 5.6 had reached EOL
  • Add PHP 7.4

Bug suddenly overwritted android payload tag

When using a payload for example:

{"notification":{"title":"We are opening soon","body":"test"}, "android": {"notification": {"sound": "soon.wav","channel_id":"soon"}}}

The "android" part is being overwritten when you set setPriority or setTimeToLive.

it is then overwritten by

"android":{"priority":"HIGH","ttl":"86400s"}

We could fix it by modifying "Client.php" to use array_replace_recursive instead of array_merge

if (!is_null($notification)) { $result = array_replace_recursive($result, $notification()); $isPlayload = true; }
if (!is_null($data)) { $result = array_replace_recursive($result, $data()); $isPlayload = true; }
if (!is_null($config)) { $result = array_replace_recursive($result, $config()); }

Which will result in:

"android":{"notification":{"sound":"soon.wav","channel_id":"soon"},"priority":"HIGH","ttl":"86400s"}

Implement manual configuration without JSON file

There might be a need not to hold JSON file as it is. Some users could holde credential information in a secret (For example, Vault by HashiCorp)

Spliting credentials configuration would be able to adapt those cases.

Key file could not be found

Screen Shot 2021-11-30 at 10 17 34 AM

Cant figure out why I get this error 'key file could not be found' I have the service account JSON in the same folder as class.

How to add payload data?

I've tried with something like:

$data = [];
$data['id'] = 10;
$data['link'] = 'https://www.github.com';
$client -> build($recipient, $notification, $data);

But got this error: "Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Argument 3 passed to phpFCMv1\Client::build() must be an instance of phpFCMv1\Data or null, array given"

...but $data is an array...

What's wrong?

Thanks.

Setup Read the Docs

For better usage, two things could be useful.

  • Read the Docs on the package
    - [ ] Add examples on Laravel (IF it is possible)
    • Maybe with queue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.