PHPackages                             mochrira/selvi-firebase - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mochrira/selvi-firebase

ActiveLibrary

mochrira/selvi-firebase
=======================

Package to integrate firebase with selvi framework

1.0.3(5y ago)147MITPHP

Since Jun 9Pushed 5y agoCompare

[ Source](https://github.com/mochrira/selvi-firebase)[ Packagist](https://packagist.org/packages/mochrira/selvi-firebase)[ RSS](/packages/mochrira-selvi-firebase/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (2)Versions (48)Used By (0)

Selvi Firebase
==============

[](#selvi-firebase)

Fastest way to integrate selvi-framework with firebase

Setup
-----

[](#setup)

Execute following lines on your cli

```
$ composer require mochrira/selvi-framework
$ composer require mochrira/selvi-firebase

```

Configuration (Single Database)
-------------------------------

[](#configuration-single-database)

Setup this package by adding following lines before `Selvi\Framework::run()` on your `index.php`

```
\Selvi\Firebase\Manager::setup(['serviceAccountFile' => 'path to your service account json']);
\Selvi\Firebase\Pengguna::setup(['schema' => 'your main schema']);

```

Setup Database
--------------

[](#setup-database)

Setup your database by running following command on your project directory

```
$ php index.php migrate main up

```

Then, check your database, and you will see the default database structure for firebase project

Accept Authorization header
---------------------------

[](#accept-authorization-header)

To accept authorization header, add following lines to the end of your `.htaccess`

```
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

```

Then add following to the top of your `index.php`

```
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Content-Type, Authorization, authorization");

```

Creating Custom Controller
--------------------------

[](#creating-custom-controller)

To validate every request to your controller, you must create custom controller for your application. Create `Controller.php` inside your project's `app` folder, and fill with the following script:

```
