naufalist / larabase

Laravel x Firebase: Simple CRUD and Authentication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel x Firebase

Simple CRUD and Authentication (using Email and Password)

Installation & Usage

  1. Install kreait using composer. Example:
composer require kreait/firebase-php ^5.0
  1. Place the script into controller directory App\Http\Controllers
  2. Change this line with your Project's Service Account (private key) and move it to controller directory
->withServiceAccount(__DIR__.'/YOUR-FIREBASE-PROJECT-adminsdk.json')
->withDatabaseUri('https://YOUR-FIREBASE-PROJECT.firebaseio.com/');
  1. Add some route (using GET) to access each method. Example:
Route::get('/signin', 'FirebaseController@signIn');
  1. Access route on your web browser. Example: http://localhost:8000/signin

Firebase Realtime Database

{
  "hewan" : {
    "herbivora" : {
      "domba" : "kecil",
      "sapi" : "besar"
    },
    "karnivora" : {
      "harimau" : {
        "benggala" : "galak",
        "sumatera" : "jinak"
      }
    },
    "omnivora" : {
      "serigala" : "galakbanget"
    }
  },
  "tumbuhan" : {
    "dikotil" : "mangga",
    "monokotil" : "bambu"
  }
}

Youtube Video

Notes

  • PHP: >= 7.2
  • Laravel: 5.8.x (min requirement | tested on 7.25.0)
  • kreait/clock: 1.0.1
  • kreait/firebase-php: 5.7.0
  • kreait/firebase-tokens: 1.10.0

References

About

Laravel x Firebase: Simple CRUD and Authentication


Languages

Language:PHP 100.0%