From d0b9b107e056a26d9ee0476aa778cb68246f261e Mon Sep 17 00:00:00 2001 From: Eric Kean Date: Wed, 1 Feb 2023 06:02:25 -0800 Subject: [PATCH 1/2] Firebase implementation --- app/FCMLog.php | 10 + app/FCMToken.php | 4 +- app/Http/Controllers/FCMTokenController.php | 59 +- app/Services/FCMService.php | 2 +- composer.json | 11 +- composer.lock | 1114 ++++++++++++++++- config/app.php | 1 + config/firebase.php | 182 +++ ...2023_02_07_201243_create_fcm_log_table.php | 35 + routes/api.php | 2 +- 10 files changed, 1347 insertions(+), 73 deletions(-) create mode 100644 app/FCMLog.php create mode 100644 config/firebase.php create mode 100644 database/migrations/2023_02_07_201243_create_fcm_log_table.php diff --git a/app/FCMLog.php b/app/FCMLog.php new file mode 100644 index 000000000..fcbf7135a --- /dev/null +++ b/app/FCMLog.php @@ -0,0 +1,10 @@ +where('user_id', $user_id)->get(); foreach ($fcm_tokens as $fcm_token) { - FCMService::send( + $fcm_token->fcm_token = 'sdfds'; + $response = FCMService::send( $fcm_token->fcm_token, [ 'title' => 'Test', 'body' => 'I cannot believe this actually worked.', ] ); + dd($response->body()); } } } diff --git a/app/Http/Controllers/FCMTokenController.php b/app/Http/Controllers/FCMTokenController.php index 1036a85ad..9e93095e4 100644 --- a/app/Http/Controllers/FCMTokenController.php +++ b/app/Http/Controllers/FCMTokenController.php @@ -3,13 +3,24 @@ namespace App\Http\Controllers; use App\Exceptions\Handler; +use App\FCMLog; use App\FCMToken; use Exception; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +use Kreait\Firebase\Exception\FirebaseException; +use Kreait\Firebase\Exception\MessagingException; +use Kreait\Firebase\Messaging; +use Kreait\Firebase\Messaging\CloudMessage; +use Kreait\Firebase\Messaging\Notification; class FCMTokenController extends Controller { + public function __construct(Messaging $messaging) + { + $this->messaging = $messaging; + } + /** * @param Request $request * @param FCMToken $FCMToken @@ -48,12 +59,50 @@ public function store(Request $request, FCMToken $FCMToken): array */ public function testSendNotification(Request $request, FCMToken $FCMToken) { - try { - $FCMToken->sendNotification($request->user()->id); - } catch (Exception $e) { - $h = new Handler(app()); - $h->report($e); + + $fcm_tokens = $FCMToken->where('user_id', 3055)->get(); + $title = 'Final message'; + $body = 'Final message body'; + foreach ($fcm_tokens as $fcm_token) { + try { + $notification = Notification::create($title, $body); + $response = CloudMessage::withTarget('token', $fcm_token->fcm_token) + ->withNotification($notification); + $response = json_encode($response->jsonSerialize()); + } catch (Exception $e) { + $response = $e->getMessage(); + } + $fcmLog = new FCMLog(); + $fcmLog->user_id = $fcm_token->user_id; + $fcmLog->response = $response; + $fcmLog->save(); } + /* $report = $this->messaging->sendMulticast($message, $deviceTokens); + echo 'Successful sends: ' . $report->successes()->count() . PHP_EOL; + //echo 'Failed sends: ' . $report->failures()->count() . PHP_EOL; + + if ($report->hasFailures()) { + foreach ($report->failures()->getItems() as $failure) { + echo $failure->error()->getMessage() . PHP_EOL; + } + } + +// Unknown tokens are tokens that are valid but not know to the currently +// used Firebase project. This can, for example, happen when you are +// sending from a project on a staging environment to tokens in a +// production environment + $unknownTargets = $report->unknownTokens(); // string[] + var_dump($unknownTargets); +// Invalid (=malformed) tokens + $invalidTargets = $report->invalidTokens(); // string[] + var_dump($invalidTargets); + var_dump($report); + // $result = $this->messaging->send($message); + + + // $FCMToken->sendNotification(3055); + */ + } } diff --git a/app/Services/FCMService.php b/app/Services/FCMService.php index 9a796282b..28c75a576 100644 --- a/app/Services/FCMService.php +++ b/app/Services/FCMService.php @@ -8,7 +8,7 @@ class FCMService { public static function send($token, $notification) { - Http::acceptJson()->withToken(config('fcm.token'))->post( + return Http::acceptJson()->withToken(config('fcm.token'))->post( 'https://fcm.googleapis.com/fcm/send', [ 'to' => $token, diff --git a/composer.json b/composer.json index 810dbe0bb..3c0fd775e 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,12 @@ "php": "^7.2.5", "ext-curl": "*", "ext-dom": "*", + "ext-fileinfo": "*", "ext-json": "*", "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-zip": "*", "doctrine/dbal": "2.*", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^1.0", @@ -31,6 +35,7 @@ "guzzlehttp/guzzle": "^6.3", "imsglobal/lti-1p3-tool": "dev-master", "irazasyed/telegram-bot-sdk": "^3.4", + "kreait/laravel-firebase": "3.0", "laravel/framework": "^7.0", "laravel/socialite": "^4.3", "laravel/tinker": "^2.0", @@ -55,11 +60,7 @@ "web-token/jwt-encryption-algorithm-aeskw": "^2.2", "web-token/jwt-encryption-algorithm-pbes2": "^2.2", "web-token/jwt-key-mgmt": "^2.2", - "web-token/jwt-signature-algorithm-hmac": "^2.2", - "ext-zip": "*", - "ext-simplexml": "*", - "ext-mbstring": "*", - "ext-fileinfo": "*" + "web-token/jwt-signature-algorithm-hmac": "^2.2" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.5", diff --git a/composer.lock b/composer.lock index b747beb6d..e0e163b7f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eefa20e33bfee8543bcfa36e1c5c7ac7", + "content-hash": "061d1078c7a4bc300cac5280b85a681f", "packages": [ { "name": "asm89/stack-cors", @@ -1030,6 +1030,124 @@ }, "time": "2020-10-22T13:48:01+00:00" }, + { + "name": "fig/http-message-util", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message-util.git", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/9d94dc0154230ac39e5bf89398b324a86f63f765", + "reference": "9d94dc0154230ac39e5bf89398b324a86f63f765", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "suggest": { + "psr/http-message": "The package containing the PSR-7 interfaces" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-message-util/issues", + "source": "https://github.com/php-fig/http-message-util/tree/1.1.5" + }, + "time": "2020-11-24T22:02:12+00:00" + }, + { + "name": "firebase/php-jwt", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "ea7dda77098b96e666c5ef382452f94841e439cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/ea7dda77098b96e666c5ef382452f94841e439cd", + "reference": "ea7dda77098b96e666c5ef382452f94841e439cd", + "shasum": "" + }, + "require": { + "php": "^7.1||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^1.1", + "phpunit/phpunit": "^7.5||^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.3.2" + }, + "time": "2022-12-19T17:10:46+00:00" + }, { "name": "fproject/php-jwt", "version": "4.0.5", @@ -1217,6 +1335,357 @@ "abandoned": true, "time": "2020-12-11T09:56:16+00:00" }, + { + "name": "giggsey/libphonenumber-for-php", + "version": "8.13.5", + "source": { + "type": "git", + "url": "https://github.com/giggsey/libphonenumber-for-php.git", + "reference": "09c60f70c539af7f2f37584eb5b53838bdd7fda9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/09c60f70c539af7f2f37584eb5b53838bdd7fda9", + "reference": "09c60f70c539af7f2f37584eb5b53838bdd7fda9", + "shasum": "" + }, + "require": { + "giggsey/locale": "^1.7|^2.0", + "php": ">=5.3.2", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "pear/pear-core-minimal": "^1.9", + "pear/pear_exception": "^1.0", + "pear/versioncontrol_git": "^0.5", + "phing/phing": "^2.7", + "php-coveralls/php-coveralls": "^1.0|^2.0", + "symfony/console": "^2.8|^3.0|^v4.4|^v5.2", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "libphonenumber\\": "src/" + }, + "exclude-from-classmap": [ + "/src/data/", + "/src/carrier/data/", + "/src/geocoding/data/", + "/src/timezone/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Joshua Gigg", + "email": "giggsey@gmail.com", + "homepage": "https://giggsey.com/" + } + ], + "description": "PHP Port of Google's libphonenumber", + "homepage": "https://github.com/giggsey/libphonenumber-for-php", + "keywords": [ + "geocoding", + "geolocation", + "libphonenumber", + "mobile", + "phonenumber", + "validation" + ], + "support": { + "issues": "https://github.com/giggsey/libphonenumber-for-php/issues", + "source": "https://github.com/giggsey/libphonenumber-for-php" + }, + "time": "2023-01-30T08:23:39+00:00" + }, + { + "name": "giggsey/locale", + "version": "2.3", + "source": { + "type": "git", + "url": "https://github.com/giggsey/Locale.git", + "reference": "5f035523740be40d40ac768a123c9bcc1ae12f56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giggsey/Locale/zipball/5f035523740be40d40ac768a123c9bcc1ae12f56", + "reference": "5f035523740be40d40ac768a123c9bcc1ae12f56", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "ext-json": "*", + "pear/pear-core-minimal": "^1.9", + "pear/pear_exception": "^1.0", + "pear/versioncontrol_git": "^0.5", + "phing/phing": "^2.7", + "php-coveralls/php-coveralls": "^2.0", + "phpunit/phpunit": "^8.5|^9.5", + "symfony/console": "^5.0|^6.0", + "symfony/filesystem": "^5.0|^6.0", + "symfony/finder": "^5.0|^6.0", + "symfony/process": "^5.0|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Giggsey\\Locale\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joshua Gigg", + "email": "giggsey@gmail.com", + "homepage": "https://giggsey.com/" + } + ], + "description": "Locale functions required by libphonenumber-for-php", + "support": { + "issues": "https://github.com/giggsey/Locale/issues", + "source": "https://github.com/giggsey/Locale/tree/2.3" + }, + "time": "2022-10-19T20:03:30+00:00" + }, + { + "name": "google/auth", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-auth-library-php.git", + "reference": "0865c44ab50378f7b145827dfcbd1e7a238f7759" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/0865c44ab50378f7b145827dfcbd1e7a238f7759", + "reference": "0865c44ab50378f7b145827dfcbd1e7a238f7759", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "^5.5||^6.0", + "guzzlehttp/guzzle": "^6.2.1|^7.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "php": "^7.1||^8.0", + "psr/cache": "^1.0|^2.0|^3.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/promises": "0.1.1|^1.3", + "kelvinmo/simplejwt": "^0.2.5|^0.5.1", + "phpseclib/phpseclib": "^2.0.31", + "phpspec/prophecy-phpunit": "^1.1||^2.0", + "phpunit/phpunit": "^7.5||^9.0.0", + "sebastian/comparator": ">=1.2.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/main/", + "issues": "https://github.com/googleapis/google-auth-library-php/issues", + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.25.0" + }, + "time": "2023-01-26T22:04:14+00:00" + }, + { + "name": "google/cloud-core", + "version": "v1.45.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-core.git", + "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/28181b5ec2d40e9c9cdf2085096b33bac1f237fd", + "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd", + "shasum": "" + }, + "require": { + "google/auth": "^1.18", + "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", + "guzzlehttp/promises": "^1.3", + "guzzlehttp/psr7": "^1.7|^2.0", + "monolog/monolog": "^1.1|^2.0", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/common-protos": "^1.0||^2.0", + "google/gax": "^1.9", + "opis/closure": "^3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "^4.8|^5.0|^8.0", + "squizlabs/php_codesniffer": "2.*", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", + "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" + }, + "bin": [ + "bin/google-cloud-batch" + ], + "type": "library", + "extra": { + "component": { + "id": "cloud-core", + "target": "googleapis/google-cloud-php-core.git", + "path": "Core", + "entry": "src/ServiceBuilder.php" + } + }, + "autoload": { + "psr-4": { + "Google\\Cloud\\Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.45.0" + }, + "time": "2022-05-13T22:51:50+00:00" + }, + { + "name": "google/cloud-storage", + "version": "v1.30.2", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-cloud-php-storage.git", + "reference": "b7f74ec1b701d56945cbc6c20345e2d21b1b3545" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/b7f74ec1b701d56945cbc6c20345e2d21b1b3545", + "reference": "b7f74ec1b701d56945cbc6c20345e2d21b1b3545", + "shasum": "" + }, + "require": { + "google/cloud-core": "^1.43", + "google/crc32": "^0.1.0" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "google/cloud-pubsub": "^1.0", + "phpdocumentor/reflection": "^3.0||^4.0", + "phpseclib/phpseclib": "^2.0||^3.0", + "phpspec/prophecy": "^1.10.3", + "phpunit/phpunit": "^4.8|^5.0|^8.0", + "squizlabs/php_codesniffer": "2.*", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.", + "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2." + }, + "type": "library", + "extra": { + "component": { + "id": "cloud-storage", + "target": "googleapis/google-cloud-php-storage.git", + "path": "Storage", + "entry": "src/StorageClient.php" + } + }, + "autoload": { + "psr-4": { + "Google\\Cloud\\Storage\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Cloud Storage Client for PHP", + "support": { + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.30.2" + }, + "time": "2023-01-27T18:26:22+00:00" + }, + { + "name": "google/crc32", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/google/php-crc32.git", + "reference": "a8525f0dea6fca1893e1bae2f6e804c5f7d007fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/php-crc32/zipball/a8525f0dea6fca1893e1bae2f6e804c5f7d007fb", + "reference": "a8525f0dea6fca1893e1bae2f6e804c5f7d007fb", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.13 || v2.14.2", + "paragonie/random_compat": ">=2", + "phpunit/phpunit": "^4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\CRC32\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Andrew Brampton", + "email": "bramp@google.com" + } + ], + "description": "Various CRC32 implementations", + "homepage": "https://github.com/google/php-crc32", + "support": { + "issues": "https://github.com/google/php-crc32/issues", + "source": "https://github.com/google/php-crc32/tree/v0.1.0" + }, + "time": "2019-05-09T06:24:58+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.5.5", @@ -1477,128 +1946,443 @@ ], "description": "A PHP fast CGI client to send requests (a)synchronously to PHP-FPM.", "keywords": [ - "Socket", - "async", - "fastcgi", - "php-fpm" + "Socket", + "async", + "fastcgi", + "php-fpm" + ], + "support": { + "issues": "https://github.com/hollodotme/fast-cgi-client/issues", + "source": "https://github.com/hollodotme/fast-cgi-client/tree/v3.1.5" + }, + "time": "2020-12-10T10:15:06+00:00" + }, + { + "name": "imsglobal/lti-1p3-tool", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/IMSGlobal/lti-1-3-php-library.git", + "reference": "3a192de99f3783d76caea462b0d04db28569c123" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/IMSGlobal/lti-1-3-php-library/zipball/3a192de99f3783d76caea462b0d04db28569c123", + "reference": "3a192de99f3783d76caea462b0d04db28569c123", + "shasum": "" + }, + "require": { + "fproject/php-jwt": "^4.0", + "phpseclib/phpseclib": "^2.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "IMSGlobal\\LTI\\": "src/lti" + } + }, + "authors": [ + { + "name": "Martin Lenord", + "email": "ims.m@rtin.dev" + } + ], + "support": { + "source": "https://github.com/IMSGlobal/lti-1-3-php-library/tree/master", + "issues": "https://github.com/IMSGlobal/lti-1-3-php-library/issues" + }, + "time": "2020-06-03T16:10:05+00:00" + }, + { + "name": "irazasyed/telegram-bot-sdk", + "version": "v3.4.1", + "source": { + "type": "git", + "url": "https://github.com/irazasyed/telegram-bot-sdk.git", + "reference": "439552ebbbbbb9051f435c6556bb1c2ba5771425" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/irazasyed/telegram-bot-sdk/zipball/439552ebbbbbb9051f435c6556bb1c2ba5771425", + "reference": "439552ebbbbbb9051f435c6556bb1c2ba5771425", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.3 || ^7.0.1", + "guzzlehttp/psr7": "^1.3", + "illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0", + "league/event": "^2.1", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "suggest": { + "illuminate/container": "Hold dependencies to be injected in commands constructors", + "irazasyed/larasupport": "Allows you to use any Laravel Package in Lumen by adding support!" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + }, + "laravel": { + "providers": [ + "Telegram\\Bot\\Laravel\\TelegramServiceProvider" + ], + "aliases": { + "Telegram": "Telegram\\Bot\\Laravel\\Facades\\Telegram" + } + } + }, + "autoload": { + "psr-4": { + "Telegram\\Bot\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Syed Irfaq R.", + "email": "syed+gh@lukonet.com", + "homepage": "https://github.com/irazasyed" + } + ], + "description": "The Unofficial Telegram Bot API PHP SDK", + "homepage": "https://github.com/irazasyed/telegram-bot-sdk", + "keywords": [ + "laravel", + "laravel telegram", + "telegram", + "telegram bot", + "telegram bot api", + "telegram php", + "telegram sdk" + ], + "support": { + "issues": "https://github.com/irazasyed/telegram-bot-sdk/issues", + "source": "https://github.com/irazasyed/telegram-bot-sdk/tree/v3.4.1" + }, + "time": "2020-12-10T19:13:03+00:00" + }, + { + "name": "kreait/clock", + "version": "1.2", + "source": { + "type": "git", + "url": "https://github.com/kreait/clock-php.git", + "reference": "49e103382ca36cb2bc2e86ff3b8d11d44d0e0b31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kreait/clock-php/zipball/49e103382ca36cb2bc2e86ff3b8d11d44d0e0b31", + "reference": "49e103382ca36cb2bc2e86ff3b8d11d44d0e0b31", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0", + "stella-maris/clock": "^0.1.4" + }, + "require-dev": { + "phpunit/phpunit": "^6.5.14" + }, + "type": "library", + "autoload": { + "files": [ + "src/Clock.php" + ], + "psr-4": { + "Kreait\\Clock\\": "src/Clock" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jérôme Gamez", + "email": "jerome@gamez.name" + } + ], + "description": "A PHP 7.0 compatible clock abstraction", + "support": { + "issues": "https://github.com/kreait/clock-php/issues", + "source": "https://github.com/kreait/clock-php/tree/1.2" + }, + "time": "2022-04-20T14:14:35+00:00" + }, + { + "name": "kreait/firebase-php", + "version": "5.11.0", + "source": { + "type": "git", + "url": "https://github.com/kreait/firebase-php.git", + "reference": "83380a3a0f15415b1eab03d3a3db19578e3bb5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kreait/firebase-php/zipball/83380a3a0f15415b1eab03d3a3db19578e3bb5c5", + "reference": "83380a3a0f15415b1eab03d3a3db19578e3bb5c5", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "giggsey/libphonenumber-for-php": "^8.9", + "google/auth": "^1.8", + "google/cloud-core": "^1.36", + "google/cloud-storage": "^1.14", + "guzzlehttp/guzzle": "^6.2.1|^7.0", + "guzzlehttp/promises": "^1.4", + "guzzlehttp/psr7": "^1.7", + "kreait/clock": "^1.0.1", + "kreait/firebase-tokens": "^1.10", + "lcobucci/jwt": "^3.3.1", + "mtdowling/jmespath.php": "^2.3", + "php": "^7.2|^8.0", + "psr/cache": "^1.0", + "psr/http-message": "^1.0", + "psr/log": "^1.1", + "psr/simple-cache": "^1.0", + "riverline/multipart-parser": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "google/cloud-firestore": "^1.11", + "jangregor/phpstan-prophecy": "^0.6.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.15", + "phpstan/phpstan-phpunit": "^0.12.6", + "phpunit/phpunit": "^8.5", + "symfony/var-dumper": "^5.0" + }, + "suggest": { + "google/cloud-firestore": "^1.0 to use the Firestore component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.x-dev", + "dev-4.x": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kreait\\Firebase\\": "src/Firebase" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jérôme Gamez", + "homepage": "https://github.com/jeromegamez" + } + ], + "description": "Firebase Admin SDK", + "homepage": "https://github.com/kreait/firebase-php", + "keywords": [ + "api", + "database", + "firebase", + "google", + "sdk" ], "support": { - "issues": "https://github.com/hollodotme/fast-cgi-client/issues", - "source": "https://github.com/hollodotme/fast-cgi-client/tree/v3.1.5" + "docs": "https://firebase-php.readthedocs.io", + "issues": "https://github.com/kreait/firebase-php/issues", + "source": "https://github.com/kreait/firebase-php" }, - "time": "2020-12-10T10:15:06+00:00" + "funding": [ + { + "url": "https://github.com/sponsors/jeromegamez", + "type": "github" + } + ], + "time": "2020-11-01T15:25:32+00:00" }, { - "name": "imsglobal/lti-1p3-tool", - "version": "dev-master", + "name": "kreait/firebase-tokens", + "version": "1.11.0", "source": { "type": "git", - "url": "https://github.com/IMSGlobal/lti-1-3-php-library.git", - "reference": "3a192de99f3783d76caea462b0d04db28569c123" + "url": "https://github.com/kreait/firebase-tokens-php.git", + "reference": "26dcb56cb49cea30fd020a416f53f59d2d78a58b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/IMSGlobal/lti-1-3-php-library/zipball/3a192de99f3783d76caea462b0d04db28569c123", - "reference": "3a192de99f3783d76caea462b0d04db28569c123", + "url": "https://api.github.com/repos/kreait/firebase-tokens-php/zipball/26dcb56cb49cea30fd020a416f53f59d2d78a58b", + "reference": "26dcb56cb49cea30fd020a416f53f59d2d78a58b", "shasum": "" }, "require": { - "fproject/php-jwt": "^4.0", - "phpseclib/phpseclib": "^2.0" + "ext-json": "*", + "ext-openssl": "*", + "fig/http-message-util": "^1.1", + "guzzlehttp/guzzle": "^6.2.1|^7.0", + "kreait/clock": "^1.0.1", + "lcobucci/jwt": "^3.2", + "php": "^7.0|^8.0", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "firebase/php-jwt": "^5.0", + "friendsofphp/php-cs-fixer": "^2.16", + "phpstan/phpstan-phpunit": "^0.9.4|^0.11.2", + "phpunit/phpunit": "^6.5.14|^7.5.17", + "symfony/cache": "^3.4.26|^4.4|^5.0", + "symfony/var-dumper": "^3.4|^4.4|^5.0" + }, + "suggest": { + "firebase/php-jwt": "^5.0 can be used to create and parse tokens", + "guzzlehttp/guzzle": "^6.2.1|^7.0 can be used as an HTTP handler", + "lcobucci/jwt": "^3.2 can be used to create and parse tokens", + "psr/cache-implementation": "to cache fetched remote public keys", + "psr/simple-cache-implementation": "to cache fetched remote public keys" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { - "IMSGlobal\\LTI\\": "src/lti" + "Firebase\\Auth\\Token\\": "src/Firebase/Auth/Token", + "Kreait\\Firebase\\JWT\\": "src/JWT" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], "authors": [ { - "name": "Martin Lenord", - "email": "ims.m@rtin.dev" + "name": "Jérôme Gamez", + "homepage": "https://github.com/jeromegamez" } ], + "description": "A library to work with Firebase tokens", + "homepage": "https://github.com/kreait/firebase-token-php", + "keywords": [ + "Authentication", + "auth", + "firebase", + "google", + "token" + ], "support": { - "source": "https://github.com/IMSGlobal/lti-1-3-php-library/tree/master", - "issues": "https://github.com/IMSGlobal/lti-1-3-php-library/issues" + "issues": "https://github.com/kreait/firebase-tokens-php/issues", + "source": "https://github.com/kreait/firebase-tokens-php/tree/1.11.0" }, - "time": "2020-06-03T16:10:05+00:00" + "funding": [ + { + "url": "https://github.com/sponsors/jeromegamez", + "type": "github" + } + ], + "time": "2020-10-04T00:32:51+00:00" }, { - "name": "irazasyed/telegram-bot-sdk", - "version": "v3.4.1", + "name": "kreait/laravel-firebase", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/irazasyed/telegram-bot-sdk.git", - "reference": "439552ebbbbbb9051f435c6556bb1c2ba5771425" + "url": "https://github.com/kreait/laravel-firebase.git", + "reference": "68e5defcddebd075f4ad50f5daeef4bba62079b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/irazasyed/telegram-bot-sdk/zipball/439552ebbbbbb9051f435c6556bb1c2ba5771425", - "reference": "439552ebbbbbb9051f435c6556bb1c2ba5771425", + "url": "https://api.github.com/repos/kreait/laravel-firebase/zipball/68e5defcddebd075f4ad50f5daeef4bba62079b1", + "reference": "68e5defcddebd075f4ad50f5daeef4bba62079b1", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "^6.3 || ^7.0.1", - "guzzlehttp/psr7": "^1.3", - "illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0", - "league/event": "^2.1", - "php": "^7.2 || ^8.0" + "illuminate/contracts": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "kreait/firebase-php": "^5.11.0", + "php": "^7.2|^8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "suggest": { - "illuminate/container": "Hold dependencies to be injected in commands constructors", - "irazasyed/larasupport": "Allows you to use any Laravel Package in Lumen by adding support!" + "friendsofphp/php-cs-fixer": "^2.16", + "orchestra/testbench": "^4.0|^5.0|^6.0", + "roave/better-reflection": "^3.6|^4.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.x-dev" }, "laravel": { "providers": [ - "Telegram\\Bot\\Laravel\\TelegramServiceProvider" + "Kreait\\Laravel\\Firebase\\ServiceProvider" ], "aliases": { - "Telegram": "Telegram\\Bot\\Laravel\\Facades\\Telegram" + "Firebase": "Kreait\\Laravel\\Firebase\\Facades\\Firebase", + "FirebaseAuth": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseAuth", + "FirebaseDatabase": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseDatabase", + "FirebaseDynamicLinks": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseDynamicLinks", + "FirebaseFirestore": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseFirestore", + "FirebaseMessaging": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseMessaging", + "FirebaseRemoteConfig": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseRemoteConfig", + "FirebaseStorage": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseStorage" } } }, "autoload": { "psr-4": { - "Telegram\\Bot\\": "src/" + "Kreait\\Laravel\\Firebase\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Syed Irfaq R.", - "email": "syed+gh@lukonet.com", - "homepage": "https://github.com/irazasyed" + "name": "Jérôme Gamez", + "email": "jerome@gamez.name" } ], - "description": "The Unofficial Telegram Bot API PHP SDK", - "homepage": "https://github.com/irazasyed/telegram-bot-sdk", + "description": "A Laravel package for the Firebase PHP Admin SDK", "keywords": [ - "laravel", - "laravel telegram", - "telegram", - "telegram bot", - "telegram bot api", - "telegram php", - "telegram sdk" + "FCM", + "firebase", + "gcm", + "laravel" ], "support": { - "issues": "https://github.com/irazasyed/telegram-bot-sdk/issues", - "source": "https://github.com/irazasyed/telegram-bot-sdk/tree/v3.4.1" + "issues": "https://github.com/kreait/laravel-firebase/issues", + "source": "https://github.com/kreait/laravel-firebase/tree/3.0.0" }, - "time": "2020-12-10T19:13:03+00:00" + "funding": [ + { + "url": "https://www.buymeacoffee.com/jeromegamez", + "type": "custom" + }, + { + "url": "https://www.paypal.me/jeromegamez", + "type": "custom" + }, + { + "url": "https://github.com/jeromegamez", + "type": "github" + }, + { + "url": "https://ko-fi.com/jeromegamez", + "type": "ko_fi" + }, + { + "url": "https://www.patreon.com/jeromegamez", + "type": "patreon" + } + ], + "time": "2020-11-01T17:36:16+00:00" }, { "name": "laravel/framework", @@ -3550,6 +4334,103 @@ ], "time": "2021-04-04T19:34:46+00:00" }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "1.1.1", @@ -4254,6 +5135,68 @@ }, "time": "2020-01-24T09:39:24+00:00" }, + { + "name": "rize/uri-template", + "version": "0.3.5", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "5ed4ba8ea34af84485dea815d4b6b620794d1168" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/5ed4ba8ea34af84485dea815d4b6b620794d1168", + "reference": "5ed4ba8ea34af84485dea815d4b6b620794d1168", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "Rize\\": "src/Rize" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "support": { + "issues": "https://github.com/rize/UriTemplate/issues", + "source": "https://github.com/rize/UriTemplate/tree/0.3.5" + }, + "funding": [ + { + "url": "https://www.paypal.me/rezigned", + "type": "custom" + }, + { + "url": "https://github.com/rezigned", + "type": "github" + }, + { + "url": "https://opencollective.com/rize-uri-template", + "type": "open_collective" + } + ], + "time": "2022-10-12T17:22:51+00:00" + }, { "name": "setasign/fpdf", "version": "1.8.2", @@ -4639,6 +5582,53 @@ ], "time": "2020-11-03T09:10:25+00:00" }, + { + "name": "stella-maris/clock", + "version": "0.1.7", + "source": { + "type": "git", + "url": "https://github.com/stella-maris-solutions/clock.git", + "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/fa23ce16019289a18bb3446fdecd45befcdd94f8", + "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0", + "psr/clock": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "StellaMaris\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Heigl", + "role": "Maintainer" + } + ], + "description": "A pre-release of the proposed PSR-20 Clock-Interface", + "homepage": "https://gitlab.com/stella-maris/clock", + "keywords": [ + "clock", + "datetime", + "point in time", + "psr20" + ], + "support": { + "source": "https://github.com/stella-maris-solutions/clock/tree/0.1.7" + }, + "time": "2022-11-25T16:15:06+00:00" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.2.7", @@ -11030,8 +12020,12 @@ "php": "^7.2.5", "ext-curl": "*", "ext-dom": "*", + "ext-fileinfo": "*", "ext-json": "*", - "ext-libxml": "*" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-zip": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/config/app.php b/config/app.php index 95798f29d..0447f604e 100644 --- a/config/app.php +++ b/config/app.php @@ -181,6 +181,7 @@ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, App\Providers\VaporUiServiceProvider::class, + Kreait\Laravel\Firebase\ServiceProvider::class ], diff --git a/config/firebase.php b/config/firebase.php new file mode 100644 index 000000000..2c6384726 --- /dev/null +++ b/config/firebase.php @@ -0,0 +1,182 @@ + env('FIREBASE_PROJECT', 'app'), + + /** + * ------------------------------------------------------------------------ + * Firebase project configurations + * ------------------------------------------------------------------------ + */ + 'projects' => [ + 'app' => [ + /** + * ------------------------------------------------------------------------ + * Credentials / Service Account + * ------------------------------------------------------------------------ + * + * In order to access a Firebase project and its related services using a + * server SDK, requests must be authenticated. For server-to-server + * communication this is done with a Service Account. + * + * If you don't already have generated a Service Account, you can do so by + * following the instructions from the official documentation pages at + * + * https://firebase.google.com/docs/admin/setup#initialize_the_sdk + * + * Once you have downloaded the Service Account JSON file, you can use it + * to configure the package. + * + * If you don't provide credentials, the Firebase Admin SDK will try to + * autodiscover them + * + * - by checking the environment variable FIREBASE_CREDENTIALS + * - by checking the environment variable GOOGLE_APPLICATION_CREDENTIALS + * - by trying to find Google's well known file + * - by checking if the application is running on GCE/GCP + * + * If no credentials file can be found, an exception will be thrown the + * first time you try to access a component of the Firebase Admin SDK. + * + */ + 'credentials' => [ + 'file' => storage_path('app/firebase_credentials.json'), + + /** + * If you want to prevent the auto discovery of credentials, set the + * following parameter to false. If you disable it, you must + * provide a credentials file. + */ + 'auto_discovery' => true, + ], + + /** + * ------------------------------------------------------------------------ + * Firebase Realtime Database + * ------------------------------------------------------------------------ + */ + + 'database' => [ + + /** + * In most of the cases the project ID defined in the credentials file + * determines the URL of your project's Realtime Database. If the + * connection to the Realtime Database fails, you can override + * its URL with the value you see at + * + * https://console.firebase.google.com/u/1/project/_/database + * + * Please make sure that you use a full URL like, for example, + * https://my-project-id.firebaseio.com + */ + 'url' => env('FIREBASE_DATABASE_URL'), + + ], + + 'dynamic_links' => [ + + /** + * Dynamic links can be built with any URL prefix registered on + * + * https://console.firebase.google.com/u/1/project/_/durablelinks/links/ + * + * You can define one of those domains as the default for new Dynamic + * Links created within your project. + * + * The value must be a valid domain, for example, + * https://example.page.link + */ + 'default_domain' => env('FIREBASE_DYNAMIC_LINKS_DEFAULT_DOMAIN') + ], + + /** + * ------------------------------------------------------------------------ + * Firebase Cloud Storage + * ------------------------------------------------------------------------ + */ + + 'storage' => [ + + /** + * Your project's default storage bucket usually uses the project ID + * as its name. If you have multiple storage buckets and want to + * use another one as the default for your application, you can + * override it here. + */ + + 'default_bucket' => env('FIREBASE_STORAGE_DEFAULT_BUCKET'), + + ], + + /** + * ------------------------------------------------------------------------ + * Caching + * ------------------------------------------------------------------------ + * + * The Firebase Admin SDK can cache some data returned from the Firebase + * API, for example Google's public keys used to verify ID tokens. + * + */ + + 'cache_store' => env('FIREBASE_CACHE_STORE', 'file'), + + /** + * ------------------------------------------------------------------------ + * Logging + * ------------------------------------------------------------------------ + * + * Enable logging of HTTP interaction for insights and/or debugging. + * + * Log channels are defined in config/logging.php + * + * Successful HTTP messages are logged with the log level 'info'. + * Failed HTTP messages are logged with the the log level 'notice'. + * + * Note: Using the same channel for simple and debug logs will result in + * two entries per request and response. + */ + + 'logging' => [ + 'http_log_channel' => env('FIREBASE_HTTP_LOG_CHANNEL', null), + 'http_debug_log_channel' => env('FIREBASE_HTTP_DEBUG_LOG_CHANNEL', null), + ], + + /** + * ------------------------------------------------------------------------ + * HTTP Client Options + * ------------------------------------------------------------------------ + * + * Behavior of the HTTP Client performing the API requests + */ + 'http_client_options' => [ + + /** + * Use a proxy that all API requests should be passed through. + * (default: none) + */ + 'proxy' => env('FIREBASE_HTTP_CLIENT_PROXY', null), + + /** + * Set the maximum amount of seconds (float) that can pass before + * a request is considered timed out + * (default: indefinitely) + */ + 'timeout' => env('FIREBASE_HTTP_CLIENT_TIMEOUT', null), + ], + + /** + * ------------------------------------------------------------------------ + * Debug (deprecated) + * ------------------------------------------------------------------------ + * + * Enable debugging of HTTP requests made directly from the SDK. + */ + 'debug' => env('FIREBASE_ENABLE_DEBUG', false), + ], + ], +]; diff --git a/database/migrations/2023_02_07_201243_create_fcm_log_table.php b/database/migrations/2023_02_07_201243_create_fcm_log_table.php new file mode 100644 index 000000000..1794e3da8 --- /dev/null +++ b/database/migrations/2023_02_07_201243_create_fcm_log_table.php @@ -0,0 +1,35 @@ +id(); + $table->unsignedBigInteger('user_id'); + + $table->string('response',2500); + $table->timestamps(); + $table->foreign('user_id')->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('fcm_log'); + } +} diff --git a/routes/api.php b/routes/api.php index 03684ef0d..09057c95e 100644 --- a/routes/api.php +++ b/routes/api.php @@ -81,7 +81,7 @@ Route::patch('/updated-information-first-application', 'UpdatedInformationFirstApplicationController@update'); Route::post('/fcm-tokens', 'FCMTokenController@store'); - Route::post('/fcm-tokens/test-send-notification', 'FCMTokenController@testSendNotification'); + Route::get('/fcm-tokens/test-send-notification', 'FCMTokenController@testSendNotification'); Route::patch('/time-zones', 'TimeZoneController@update'); Route::post('/tester/email-results/{student}', 'TesterController@emailResults'); From 8356e5c33e2013b9a93a9c8c7bb341bf6ddc8f5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 20:29:41 +0000 Subject: [PATCH 2/2] Bump guzzlehttp/psr7 from 1.8.1 to 1.9.0 Bumps [guzzlehttp/psr7](https://github.com/guzzle/psr7) from 1.8.1 to 1.9.0. - [Release notes](https://github.com/guzzle/psr7/releases) - [Changelog](https://github.com/guzzle/psr7/blob/1.9.0/CHANGELOG.md) - [Commits](https://github.com/guzzle/psr7/compare/1.8.1...1.9.0) --- updated-dependencies: - dependency-name: guzzlehttp/psr7 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 59 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index e0e163b7f..abbf875f5 100644 --- a/composer.lock +++ b/composer.lock @@ -1814,16 +1814,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.8.1", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1" + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/35ea11d335fd638b5882ff1725228b3d35496ab1", - "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", "shasum": "" }, "require": { @@ -1844,29 +1844,50 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.9-dev" } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], @@ -1883,9 +1904,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.1" + "source": "https://github.com/guzzle/psr7/tree/1.9.0" }, - "time": "2021-03-21T16:25:00+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-06-20T21:43:03+00:00" }, { "name": "hollodotme/fast-cgi-client", @@ -12031,5 +12066,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" }