kakaprodo / murugo-analytic-helper
A laravel package that lets you interact with murugo analytic APIs
Package info
github.com/kakaprodo/murugo-analytic-helper
Type:package
pkg:composer/kakaprodo/murugo-analytic-helper
Requires
- php: >=8.0
- kakaprodo/custom-data: >=2.3 || dev-develop
- laravel/framework: >=7.0
This package is auto-updated.
Last update: 2026-07-14 13:53:46 UTC
README
A laravel package that lets you interact with murugo analytic APIs
Package Installation
composer require kakaprodo/murugo-analytic-helper
Publish config file
php artisan murugo-analytic-helper:install
The config file will be published to your /config folder
Setup the .env file
Based on the enviroment in the config file you can define env variables
Activable Features
Use the MurugoAnalyticHelper::features() service gate to interact with activable features that you have registered on your Murugo Analytic account.
.env file requirement
You should define the following variables in your .env file
MURUGO_ANALYTIC_BASE_URL="https://analytics.murugo.cloud" MURUGO_ANALYTIC_ENVIRONMENT_UUID="environment-uuid"
Fetch all available features
Use the following example to retrieve all activable features configured for the current environment:
use Kakaprodo\MurugoAnalyticHelper\MurugoAnalyticHelper; use RuntimeException; $responseData = MurugoAnalyticHelper::features()->all(); if (! $responseData->isOk()) { throw new RuntimeException($responseData->getErrorMessage()); } $features = $responseData->features;
The features will be fetched at once and stored in your caching store for 1hour(you may change this in the config file).
The feature's all method support additional parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
email |
string |
null |
Optional email address used to check whether the user is on a feature's waiting list. If the email is found, the corresponding feature will be activated for that specific user (subject to the feature configuration). |
force |
bool |
false |
When set to true, bypasses the cached feature list and fetches the latest features directly from the Murugo Analytic API. |
use Kakaprodo\MurugoAnalyticHelper\MurugoAnalyticHelper; use RuntimeException; $responseData = MurugoAnalyticHelper::features()->all([ 'email' => 'kakaprodo@gmail.com', 'force' => true ]); if (! $responseData->isOk()) { throw new RuntimeException($responseData->getErrorMessage()); }
Get a specific feature
$featureData = $responseData->getFeature($featureKey); // return \Kakaprodo\MurugoAnalyticHelper\Services\Features\ResponseData\Partial\ActivatedFeatureData
getFeature() returns the matching feature when it exists, or null when the feature key is not found.
Check feature access
$canAccess = $responseData->canAccessFeature($featureKey);
canAccessFeature() returns a boolean:
truewhen the feature is accessible.falsewhen the feature is unavailable, inactive, locked, or inaccessible to the current user.
Error handling
Check the response with isOk() before using the data. When the request fails, call getErrorMessage() and throw a standard PHP exception or handle the error in your application flow.