Firebase Admin SDK for PHP¶
Interact with Google Firebase from your PHP application.
Note
If you are interested in using the PHP Admin SDK as a client for end-user access (for example, in a web application), as opposed to admin access from a privileged environment (like a server), you should instead follow the instructions for setting up the client JavaScript SDK.
The source code can be found at https://github.com/kreait/firebase-php/ .
Quick Start¶
use Kreait\Firebase\Factory;
$factory = (new Factory)
->withServiceAccount('/path/to/firebase_credentials.json')
->withDatabaseUri('https://my-project-default-rtdb.firebaseio.com');
$auth = $factory->createAuth();
$realtimeDatabase = $factory->createDatabase();
$cloudMessaging = $factory->createMessaging();
$remoteConfig = $factory->createRemoteConfig();
$cloudStorage = $factory->createStorage();
$firestore = $factory->createFirestore();
User Guide¶
- Overview
- Setup
- Cloud Messaging
- Initializing the Messaging component
- Getting started
- Send messages to topics
- Send conditional messages
- Send messages to specific devices
- Send messages to multiple devices (Multicast)
- Send multiple messages at once
- Adding a notification
- Adding data
- Changing the message target
- Adding target platform specific configuration
- Adding platform independent FCM options
- Notification Sounds
- Message Priority
- Using Emojis
- Sending a raw/custom messages
- Validating messages
- Validating Registration Tokens
- Topic management
- App instance management
- Error Handling
- Cloud Firestore
- Cloud Storage
- Realtime Database
- Authentication
- User management
- User Records
- List users
- Query users
- Get information about a specific user
- Get information about multiple users
- Create a user
- Update a user
- Change a user’s password
- Change a user’s email
- Disable a user
- Enable a user
- Custom user claims
- Delete a user
- Delete multiple users
- Duplicate/Unregistered email addresses
- Using Email Action Codes
- Dynamic Links
- Remote Config
- App Check
- Framework Integrations
- Testing and Local Development
- Troubleshooting
- Error handling
- Call to private/undefined method …
- PHP Parse Error/PHP Syntax Error
- Class ‘Kreait\Firebase\ …’ not found
- Call to undefined function
openssl_sign()
- Default sound not played on message delivery
- cURL error XX: …
- “403 Forbidden” Errors
- MultiCast SendReports are empty
- Proxy configuration
- Debugging