Firebaseのrealtime databaseを使ってみる

$ curl -sS https://getcomposer.org/installer | php
// composer動作確認
$ php composer.phar
$ php composer.phar require ktamas77/firebase-php

$ sudo apt-get install php7.4-curl
$ php -v

require_once "vendor/autoload.php";

define("DEFAULT_URL","https://*-default-rtdb.firebaseio.com");
define("DEFAULT_TOKEN","");

$test = array(
	"name" => "Polkadot",
	"code" => "DOT"
);

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

$firebase->set("/users",$test);

$user = $firebase->get("/users");

echo $user;

$ php test.php
{“code”:”DOT”,”name”:”Polkadot”}

おおおおお、なんか感動した!