injamio/injam-laravel-package

Injam.io Laravel Package

0.2 2018-05-30 22:40 UTC

This package is not auto-updated.

Last update: 2024-04-14 02:56:16 UTC


README

Build Status styleci Scrutinizer Code Quality SensioLabsInsight Coverage Status

Packagist Packagist Packagist

"Injam" is a Next Generation Real-Time Machine that provides a set of Geolocation, Geospatial, Messaging and Streaming services in fast (almost-teleporting) and secure way. So this Package enables you to interact with them easily from server side.

Installation

Install via composer

composer require injamio/injam-laravel-package

Register Service Provider

Note: This and next steps are optional if you use Laravel >= 5.5 with package auto discovery feature.

Add service provider to config/app.php in providers section

Injamio\InjamLaravelPackage\ServiceProvider::class,

Register Facade

Register package facade in config/app.php in aliases section

'Injamio' => Injamio\InjamLaravelPackage\Facades\InjamLaravelPackage::class,

Publish Configuration File

php artisan vendor:publish --provider="Injamio\InjamLaravelPackage\ServiceProvider" --tag="config"

API Key

Add INJAM_API_KEY to your .env file:

INJAM_API_KEY=YOUR_INJAM_API_KEY

Here you can find you application api key.

Usage

Use package in your controller:

use Injamio\InjamLaravelPackage\InjamLaravelPackage;

Create instance of InjamLaravelPackage class:

$injam = new InjamLaravelPackage;

Add Tracker:

$tracker = $injam->addTracker(TRACKING_PHYSICAL_ID, TRACKER_MOBILE);

Example:

$tracker = $injam->addTracker('zxcvbn', '09123456789');

Add Geofence webhook:

$hook = $injam->addGeoFenceWebhook(OBJECT_TYPE, PHYSICAL_ID, TARGET_POINT, RADIUS_IN_METERS, ENDPOINT, DETECT_EVENTS);

Example:

$hook = $injam->addGeoFenceWebhook('bike', 'zxcvbn', '35.7384336,51.4026536', 60, 'https://api.example.com/v1/do/action', 'enter,exit');