定制 safestudio/firebase-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

safestudio/firebase-laravel

最新稳定版本:1.0.8

Composer 安装命令:

composer require safestudio/firebase-laravel

包简介

Firebase REST API easy wrapper for Laravel and Lumen

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Installation

Laravel

composer require safestudio/firebase-laravel

After installing composer package, add the ServiceProvider to the providers array in config/app.php

SafeStudio\Firebase\FirebaseServiceProvider::class,

Add this to your aliases for shorter code:

'Firebase' => SafeStudio\Firebase\Facades\FirebaseFacades::class,

Insert the config settings in config/services.php like this:

    'firebase' => [
        'database_url' => env('FB_DATABASE', 'https://project-id.firebaseio.com/'),
        'secret' => env('FB_DATABASE_KEY', 'dbsecretkey'),
    ]

You can get Firebase secret token like so:

  • Click on the gear icon in you Firebase Console
  • Click Project settings
  • Click on the Service Account tab
  • Click on the Database Secrets link in the inner left-nav
  • Hover over the non-displayed secret and click Show

Lumen

composer require safestudio/firebase-laravel

After installing composer package, add the ServiceProvider to the providers array in bootstrap/app.php

$app->register(SafeStudio\Firebase\FirebaseServiceProvider::class);

Add this to your aliases for shorter code:

class_alias(SafeStudio\Firebase\Facades\FirebaseFacades::class, 'Firebase');

Make sure this line is uncommented:

$app->withFacades();

Add this line:

$app->configure('services');

Insert the environment variables in .env like this:

FB_DATABASE=https://PROJECT.firebaseio.com
FB_DATABASE_KEY=KB2xZjJgAvmPROJECT8ykNrT6f2emuuaxJTr9

Insert the config settings in config/services.php like this:

    'firebase' => [
        'database_url' => env('FB_DATABASE', 'https://project-id.firebaseio.com/'),
        'secret' => env('FB_DATABASE_KEY', 'dbsecretkey'),
    ]

You can get Firebase secret token like so:

  • Click on the gear icon in you Firebase Console
  • Click Project settings
  • Click on the Service Account tab
  • Click on the Database Secrets link in the inner left-nav
  • Hover over the non-displayed secret and click Show

Usage

$data = ['key' => 'data' , 'key1' => 'data1']
Firebase::set('/test/',$data); 

Firebase::get('/test/',['print'=> 'pretty']);

Firebase::push('/test/',$data); 

Firebase::update('/test/',['key1' => 'Updating data by key']); 

Firebase::delete('/test/'); 

For more options see firebase REST official documentation

统计信息

  • 总下载量: 8.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 26
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 26
  • Watchers: 7
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-25