rezuankassim / bqanalytic
This is a package to ease integration between BigQuery and Firebase Analytics
Requires
- google/cloud-bigquery: ^1.15
- illuminate/support: ~5|~6|~7
- pragmarx/countries: ^0.7.0
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
- dev-master
- 1.4.2
- 1.4.1
- 1.4
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dependabot/composer/symfony/http-kernel-4.4.50
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-dependabot/composer/league/flysystem-1.1.4
- dev-develop
- dev-revamp_structure
- dev-feature/views
This package is auto-updated.
Last update: 2025-01-30 02:08:22 UTC
README
This is where your description should go. Take a look at contributing.md to see a to do list.
Installation
Via Composer
$ composer require rezuankassim/bqanalytic
Optionally you can publish the configuration file
$ php artisan vendor:publish RezuanKassim/BQAnalytic/BQAnalyticServiceProvider
Important
In your .env file, make sure you have these value setup
GOOGLE_CLOUD_APPLICATION_CREDENTIALS=path_to_your_credentials_file
GOOGLE_CLOUD_PROJECT_ID=your_google_cloud_project_id
BQANALYTIC_BQ_TABLE_NAME=your_bigquery_datasets_name
GOOGLE_CLOUD_APPLICATION_NAME=your_google_cloud_application_name
Then
$ php artisan migrate
After that
$ php artisan db:seed --class=AnalyticSeeder
If you an error popup when running the command above, you need to publish the vendor file.
Usage
Include this code into your user entity
use RezuanKassim\BQAnalytic\Traits\hasAnalyticPreferences; .... class User extends Authenticatable { use Notifiable, hasAnalyticPreferences;
Then run php artisan bqanalytic:export
to export big query data into your local database
Note that: php artisan bqanalytic:export
can receive two date which is start date and end date behind it like php artisan bqanalytic:export 20200420 20200420
Next, in your controller
use RezuanKassim\BQAnalytic\BQAnalytic; ... $results = (new BQAnalytic(auth()->user(), Carbon::createFromFormat('d/m/Y', $range[0])->format('Ymd'), Carbon::createFromFormat('d/m/Y', $range[1])->format('Ymd')))->getAllAnalytics()[config('bqanalytic.google.accounts')[0]['name']];
Optionally you can enable multiple project by
BQANALYTIC_MULTIPLE_PROJECTS=true
setting this variable in your env and publishing the config file
and insert the code below in google => [accounts => [here]]
[ 'name' => 'YOUR_PROJECT_NAME', 'google_credential' => "FULL_PATH_TO_YOUR_CREDENTIALS", 'google_project_id' => 'PROJECT_ID', 'google_bq_dataset_name' => 'YOUR_DATASET_NAME' ]
By version 1.3, you are able to store all the clients in the database if you wish
BQANALYTIC_CLIENT_FROM_DB=true
in .env file
This will use an included RezuanKassim\BQAnalytic\BQClient
model to store the clients information
Optionally you also can use own model by including
BQANALYTIC_CLIENT_MODEL=App\Client
in .env file
But remember to include these codes in your client model
use RezuanKassim\BQAnalytic\Traits\hasClientFromDB; ... class Client extends Model { use hasClientFromDB; protected $table = 'bq_clients'; protected $guarded = ['created_at', 'updated_at', 'id']; protected $casts = [ 'status' => 'boolean' ]; }
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.