Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for contributors to upgrade this project to HTTP v1 #67

Open
rolinger opened this issue Sep 7, 2024 · 2 comments
Open

Looking for contributors to upgrade this project to HTTP v1 #67

rolinger opened this issue Sep 7, 2024 · 2 comments

Comments

@rolinger
Copy link
Collaborator

rolinger commented Sep 7, 2024

If anyone wants to migrate/upgrade this API please have at it. It is light and nimble but is going to require a decent amount of rewrites to support the HTTP v1 API - the Legacy FCM api that this repository interfaces with is now retired and not supported anymore.

For the moment, I am moving to "firebase-php" as it is an active and fully supported HTTP v1 interface. I don't need all the extra stuff from firebase-php, yet I also do not have the time to recode this php-fcm repo.

@kw-pr
Copy link

kw-pr commented Sep 17, 2024

Yes, same her.

Install the laravel version:

composer require kreait/laravel-firebase

Generate and download the private key .json: https://firebase-php.readthedocs.io/en/7.15.0/setup.html#google-service-account

I published the config:

php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config

and copied the array from the private key .json into config/firebase.php.

See: https://github.com/kreait/laravel-firebase?tab=readme-ov-file#credentials-with-arrays

Now you are good to go:

use Kreait\Firebase\Exception\FirebaseException;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Messaging\AndroidConfig;
use Kreait\Firebase\Messaging\CloudMessage;

$config = AndroidConfig::fromArray([
    'ttl' => '3600s',
    'priority' => 'normal',
    'notification' => [
        'title' => '$GOOG up 1.43% on the day',
        'body' => '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.',
        'icon' => 'stock_ticker_update',
        'color' => '#f45342',
        'sound' => 'default',
    ],
]);

$cloudMessage = CloudMessage::withTarget('token', $token);
$cloudMessage = $cloudMessage->withAndroidConfig($config);

See also https://firebase-php.readthedocs.io/en/7.15.0/cloud-messaging.html#adding-target-platform-specific-configuration

@rolinger
Copy link
Collaborator Author

The most I might ever get around to contributing to is this repository: https://github.com/lkaybob/php-fcm-v1

Its JUST the cloud messaging...so its light compared to the full firebase-php I listed above...but I am almost done with my full fireabase-php migration; so once I am done with that I don't see me working on more FCM stuff anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants