Overview

Requirements

Installation

The recommended way to install the Firebase Admin SDK is with Composer. Composer is a dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.

If you want to use the SDK within a Framework, please follow the installation instructions here:

composer require kreait/firebase-php

After installing, you need to require Composer’s autoloader:

<?php

require __DIR__.'/vendor/autoload.php';

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Please continue to the Setup section to learn more about connecting your application to Firebase.

Usage examples

You can find usage examples in the tests directory of this project’s GitHub repository.

Issues/Support

License

Licensed using the MIT license.

Copyright (c) Jérôme Gamez <https://github.com/jeromegamez> <jerome@gamez.name>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributing

Guidelines

  1. The SDK utilizes PSR-4, PSR-7 and PSR-12.

  2. This SDK has a minimum PHP version requirement of PHP 8.1.

  3. All pull requests should include unit tests to ensure the change works as expected and to prevent regressions.

Running the tests

The SDK is unit tested with PHPUnit. Run the tests using the Makefile:

make tests

Coding standards

The SDK uses the PHP Coding Standards Fixer to ensure a uniform coding style. Apply coding standard fixed using the Makefile:

make cs

from the root of the project.