kreait / firebase-php

Unofficial Firebase Admin SDK for PHP
https://firebase-php.readthedocs.io/
MIT License
2.28k stars 433 forks source link

New FCM API #905

Closed domenico-renna closed 4 months ago

domenico-renna commented 5 months ago

Describe the bug

Hi, I'm using an old version of your SDK (5.x) embedded in my company app skeleton with the aim to migrate to the new 7.x release as soon as possible.

Today we receive the following message from google:

Hi Domenico, We’re writing to remind you that starting June 20, 2024 the legacy Firebase Cloud Messaging (FCM) APIs will be discontinued. This change will cause the legacy APIs to return an increased number of error responses.

The discontinued APIs will be completely shut down by July-August 2024.

Does version 5.x support the new FCM APIs or is mandatory to migrate to last release?

Thanks, Domenico

Installed packages

kreait/clock                        1.2         A PHP 7.0 compatible clock abstraction
kreait/firebase-php                 5.26.5      Firebase Admin SDK
kreait/firebase-tokens              1.17.0      A library to work with Firebase tokens

PHP version and extensions

ext-amqp                2.1.1     The amqp PHP extension
ext-apcu                5.1.22    The apcu PHP extension
ext-bcmath              8.2.8     The bcmath PHP extension
ext-bz2                 8.2.8     The bz2 PHP extension
ext-calendar            8.2.8     The calendar PHP extension
ext-ctype               8.2.8     The ctype PHP extension
ext-curl                8.2.8     The curl PHP extension
ext-date                8.2.8     The date PHP extension
ext-dom                 20031129  The dom PHP extension
ext-exif                8.2.8     The exif PHP extension
ext-ffi                 8.2.8     The FFI PHP extension
ext-fileinfo            8.2.8     The fileinfo PHP extension
ext-filter              8.2.8     The filter PHP extension
ext-ftp                 8.2.8     The ftp PHP extension
ext-gettext             8.2.8     The gettext PHP extension
ext-hash                8.2.8     The hash PHP extension
ext-iconv               8.2.8     The iconv PHP extension
ext-igbinary            3.2.14    The igbinary PHP extension
ext-imagick             3.7.0     The imagick PHP extension
ext-intl                8.2.8     The intl PHP extension
ext-json                8.2.8     The json PHP extension
ext-libxml              8.2.8     The libxml PHP extension
ext-mbstring            8.2.8     The mbstring PHP extension
ext-mysqli              8.2.8     The mysqli PHP extension
ext-mysqlnd             0         The mysqlnd PHP extension (actual version: mysqlnd 8.2.8)
ext-openssl             8.2.8     The openssl PHP extension
ext-pcntl               8.2.8     The pcntl PHP extension
ext-pcre                8.2.8     The pcre PHP extension
ext-pdo                 8.2.8     The PDO PHP extension
ext-pdo_mysql           8.2.8     The pdo_mysql PHP extension
ext-pdo_sqlite          8.2.8     The pdo_sqlite PHP extension
ext-phar                8.2.8     The Phar PHP extension
ext-posix               8.2.8     The posix PHP extension
ext-random              8.2.8     The random PHP extension
ext-readline            8.2.8     The readline PHP extension
ext-redis               5.3.7     The redis PHP extension
ext-reflection          8.2.8     The Reflection PHP extension
ext-session             8.2.8     The session PHP extension
ext-shmop               8.2.8     The shmop PHP extension
ext-simplexml           8.2.8     The SimpleXML PHP extension
ext-soap                8.2.8     The soap PHP extension
ext-sockets             8.2.8     The sockets PHP extension
ext-sodium              8.2.8     The sodium PHP extension
ext-spl                 8.2.8     The SPL PHP extension
ext-sqlite3             8.2.8     The sqlite3 PHP extension
ext-sysvmsg             8.2.8     The sysvmsg PHP extension
ext-sysvsem             8.2.8     The sysvsem PHP extension
ext-sysvshm             8.2.8     The sysvshm PHP extension
ext-tokenizer           8.2.8     The tokenizer PHP extension
ext-xdebug              3.2.1     The xdebug PHP extension
ext-xml                 8.2.8     The xml PHP extension
ext-xmlreader           8.2.8     The xmlreader PHP extension
ext-xmlwriter           8.2.8     The xmlwriter PHP extension
ext-xsl                 8.2.8     The xsl PHP extension
ext-zend-opcache        8.2.8     The Zend OPcache PHP extension
ext-zip                 1.21.1    The zip PHP extension
ext-zlib                8.2.8     The zlib PHP extension
lib-amqp-librabbitmq    0.10.0    AMQP librabbitmq version
lib-amqp-protocol       0.9.1     AMQP protocol version
lib-bz2                 1.0.8     The bz2 library
lib-curl                7.68.0    The curl library
lib-curl-libssh         0.9.3     curl libssh version
lib-curl-openssl        1.1.1.6   curl OpenSSL version (1.1.1.6)
lib-curl-zlib           1.2.11    curl zlib version
lib-date-timelib        2022.07   date timelib version
lib-date-zoneinfo       0         zoneinfo ("Olson") database for date
lib-fileinfo-libmagic   540       fileinfo libmagic version
lib-iconv               2.31      The iconv library
lib-icu                 66.1      The ICU unicode and globalization support library
lib-icu-cldr            36.1      ICU CLDR project version
lib-icu-unicode         13.0.0    ICU unicode version
lib-icu-zoneinfo        2024.1    zoneinfo ("Olson") database for icu
lib-imagick-imagemagick 6.9.10.23 The imagick-imagemagick library
lib-libsodium           1.0.18    The libsodium library
lib-libxml              2.9.14    libxml library version
lib-libxslt             1.1.34    The libxslt library
lib-libxslt-libxml      2.9.10    libxml version libxslt is compiled against
lib-mbstring-libmbfl    1.3.2     mbstring libmbfl version
lib-mbstring-oniguruma  6.9.4     mbstring oniguruma version
lib-openssl             1.1.1.6   OpenSSL 1.1.1f  31 Mar 2020
lib-pcre                10.40     The pcre library
lib-pcre-unicode        14.0.0    PCRE Unicode version support
lib-pdo_sqlite-sqlite   3.31.1    The pdo_sqlite-sqlite library
lib-sqlite3-sqlite      3.31.1    The sqlite3-sqlite library
lib-zip-libzip          1.7.3     The zip-libzip library
lib-zlib                1.2.11    The zlib library
php                     8.2.8     The PHP interpreter
php-64bit               8.2.8     The PHP interpreter, 64bit
php-ipv6                8.2.8     The PHP interpreter, with IPv6 support

Steps to reproduce the issue.

# Insert the commands issued in the terminal if they are needed
# to reproduce the issue. Otherwise, delete this code block.
// Insert the PHP code to reproduce the issue. Please ensure that it is code that
// can be copy pasted to reproduce it.

Error message/Stack trace

No error message, my message is simply a compatibility request

Additional information

No response

jeromegamez commented 5 months ago

Version 5.x supports the new FCM API, so you don't need to upgrade the SDK right away πŸ₯³

aneip commented 5 months ago

What about version 2.x?

jeromegamez commented 5 months ago

What about version 2.x?

You can't be serious 🀑

aneip commented 5 months ago

What about version 2.x?

You can't be serious 🀑

Unfortunately yes. We use custom library to send notifications. When getting the email about the legacy Api termination, just find out the library using kreait/firebase-php v2. Can I know what the minimum version we need to upgrade so it use new firebase http api?

jeromegamez commented 5 months ago

Version 2.x doesn't even include support for FCM πŸ˜…

Paco777 commented 5 months ago

Hello, Back in December, when Google began sending email about the discontinuation, the email sent to me contained :

Your recent usage of impacted APIs/features: Batch send API

Decommissioned service: Including multiple send requests in a single HTTP request to FCM known as Batch Send.

New alternative: Send messages via the HTTP v1 API, which has been optimized for fanout performance

I am using version 6.1, and I don't think I do some Firebase Cloud Messaging myself anywhere else. Any idea of why I received this message ?

jeromegamez commented 5 months ago

Up to 6.x, the SDK uses the HTTP v1 API for single messages and the batch API for batch/multicast messages (the sendMulticast() and sendAll() methods, if I remember correctly.

@domenico-renna I think I must retract my previous message πŸ˜•

I'm not a 100% sure, but I don't have the time or opportunity to search right now...

Paco777 commented 5 months ago

That makes sense, thank you. I'm in the process of upgrading to 7.12, fortunately we have one more month to do that. The most annoying thing is that I have to upgrade the php engine from 7.4 to 8.1 which might need a few changes here and there (well the main problem I had yet was just a deprecation warning, in fact).

jeromegamez commented 5 months ago

Upgrading PHP versions, thankfully, has become much less of a pain, in my experience, it sounds as if you had a well-maintained code base, if all you got is a deprecation warning πŸ˜…

I'm trying to make upgrading the SDK as painless as possible as well - as long as you're not doing some fancy things, it should be quite easy. I hope πŸ˜…

aneip commented 5 months ago

Version 2.x doesn't even include support for FCM πŸ˜…

sorry see wrong packages. It's midnight time when I last reply. Anyway, below is correct version

kreait/firebase-php                          5.26.5              Firebase Admin SDK
kreait/laravel-firebase                      2.4.0               A Laravel package for the Firebase PHP Admin SDK

So i need to upgrade to kreait/laravel-firebase v4.x and kreait/firebase-php v6.x to be safe? Currently Im using php 8.0

jeromegamez commented 5 months ago

Ah, got it! You should be safe with your current versions, since your using 5.x of the SDK 🀞🏻

nomori7010 commented 4 months ago

I am using version 4.44.0, do I need to update it?

jeromegamez commented 4 months ago

Yes. If you scroll up, you can see that you'll need at least version 5.

nomori7010 commented 4 months ago

Yes. If you scroll up, you can see that you'll need at least version 5.

In my application, I send Cloud Messages using the sendAll method. In that case, wouldn't it be true that the sendAll method using https://fcm.googleapis.com/batch cannot be resolved even in Ver5?

jeromegamez commented 4 months ago

Uh! You're right! I just thought of the API for sending single messages.

If you use the sendAll() or sendMulticast() methods, you indeed need to upgrade to the latest version of the SDK.