ktamas77 / firebase-php

Firebase PHP Client
791 stars 215 forks source link

FirebaseLib #72

Closed oswazteca closed 5 years ago

oswazteca commented 7 years ago

With the following code...

<?php
require __DIR__.'/vendor/autoload.php';
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
const DEFAULT_URL = 'https://dbname.firebaseio.com/';
const DEFAULT_TOKEN = '<tokenfromfirebasewebpage>';
const DEFAULT_PATH = '/firebase/example';

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");

// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');

I am getting the following error: screenshot from 2017-06-08 19-41-55

In the composer.json I have:

"require": {
        "php": ">=5.2.4",
        "kreait/firebase-php": "^3.0"
    }

I am using CodeIgniter 3 but I think that isn't the problem, any idea what it could be?

iprastha commented 7 years ago

Your composer require should be "ktamas77/firebase-php": "dev-master" You are including another PHP firebase library (kreait/firebase-php) instead of this one