Code Monkey home page Code Monkey logo

yii2-firebase's Introduction

yii2-firebase

Latest Stable Version Total Downloads Latest Unstable Version License

This Yii2 component wraps kreait/firebase-php and allow to easy connect to the Firebase realtime database

Installation

Preferred way to install is through Composer:

php composer.phar require grptx/yii2-firebase:~0.3.1

Or, you may add

"grptx/yii2-firebase": "~0.3.1"

to the require section of your composer.json file and execute php composer.phar update.

Configuration

...
'components' => [
    'firebase' => [
        'class'=>'grptx\Firebase\Firebase',
        'credential_file'=>'service_account.json', // (see https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app)
        'database_uri'=>'https://my-project.firebaseio.com', // (optional)
    ]
...
]

Optional

to use the autocomplete function of IDE (i.e. Phpstorm) you can optionally replace in the web/index.php the inclusion of Yii.php file and the Application instance:

replace:

require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
//and 
(new yii\web\Application($config))->run();

with:

require (__DIR__.'/../../vendor/grptx/yii2-firebase/src/yii2/Yii.php');
//and
(new \grptx\Firebase\web\Application($config))->run();

now when you need you can use grptx\Firebase\yii2\Yii instead of Yii to use autocomplete of your IDE

Usage

Retrive a database ,reference and a value

$database = Yii::$app->firebase->getDatabase();
$reference = $database->getReference('path/to/child/location');
$value = $reference->getValue();

or just the reference and a value

$reference = Yii::$app->firebase->getReference('path/to/child/location');
$value = $reference->getValue();

for other method see firebase-php.readthedocs.io.

yii2-firebase's People

Contributors

grptx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yii2-firebase's Issues

Please update it with new version of kreait/firebase-php

Hi,
I want to use the FCM message but not able to use it. which is implemented in kreait/firebase-php : ^4.0.
Please update it with new updated version for kreait/firebase-php.

I had try to update firebase-php with 'composer update grptx/yii2-firebase' command but not get any success.
if i can update it with new version then please help me.

Multiple delete

I need to make deleting of data for many rows > 1k. For now I makes delete only by one entry, can it may like for all rows right away? How it can be if possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.