Filter - magnussolution/magnusbilling-api GitHub Wiki

Welcome to the magnusbilling-api-php wiki!

How use setFilter method.

<?php
require_once "vendor/autoload.php";

use magnusbilling\api\magnusBilling;

$magnusBilling             = new MagnusBilling('API KEY', 'SECRET KEY');

$magnusBilling->public_url = "http://1.1.1.1/mbilling"; // Your MagnusBilling URL

//set filter to find data that have credit > 10, type numeric.
$magnusBilling->setFilter('credit', '10', 'gt', 'numeric');
//you can set multiple filter: ex
$magnusBilling->setFilter('credit', '50', 'lt', 'numeric');

//above filter will find per credit > 10 and < 50

//execute the read method on user medule
$result = $magnusBilling->read('user');

print($result);

This method has 4 variables.

  1. Field (required).
  2. Value (required)
  3. Comparison (optional)
  4. Filter Type (optional)

Filter Type:

  1. string Comparison available:
  • st = Start with
  • ed = End with
  • ct = Contain
  • eq = Equal
  1. numeric Comparison available:
  • eq = Equal
  • lt = Less than
  • gt = Great than
  1. date Comparison available:
  • eq = eq
  • lt = Less than
  • gt = Great than