divinityfound/churchmetricsapiphp

There is no license information available for the latest version (dev-master) of this package.

Free public churchmetrics.com API in PHP

dev-master 2020-02-01 16:00 UTC

This package is not auto-updated.

Last update: 2024-12-15 15:07:20 UTC


README

License: MIT

Contents

  1. About

  2. Installation via Composer

  3. Usage Example

  4. About

Church Metrics (originally) did not have a publicly available PHP API, though they did have an a public API... so I chose to remedy that situation to make it easier to implement Church Metrics API via PHP.

To view the original API, visit here: https://github.com/lifechurch/churchmetrics-api

Currently this API only "Gets" data from Church Metrics API. It does not modify any data (as of yet);

  1. Installation via Composer
{
	"require": {
		"divinityfound/churchmetricsapiphp": "dev-master"
	},
	"minimum-stability": "dev"
}

Then install with Composer

$ composer install
  1. Usage Examples
// Load Rest Client
require_once(__DIR__ . '/../vendor/autoload.php');
use \Divinityfound\ChurchMetricsApiPhp\Rest;

// Define API Credentials
define('CHURCH_METRICS_EMAIL', 'XXXXXX@XXXXXXXXX.com');
define('CHURCH_METRICS_AUTH' , 'XXXXXXXXXXXXXXXXXXXX');

//Implement Church Metrics Client
$CM_Client = new Rest(CHURCH_METRICS_EMAIL, CHURCH_METRICS_AUTH);

// Campuses
$params  = [];
$params  = ['url' 			 => '1'];
$params  = ['url' 			 => 'weekly_totals',
			'category_id'    => '1', // Required
			'week_reference' => '5275']; //Optional
$results = $CM_Client->campuses($params);

// Categories
$params  = [];
$params  = ['url' => '1'];
$results = $CM_Client->categories($params);

// Deprecated
// Churches
$params  = ['url' => 'me'];
$params  = ['url' => 'weekly_totals',
			'category_id'    => '1',  // Required
			'week_reference' => '1']; // Optional
$results = $CM_Client->churches($params);

// Events
$params  = [];
$params  = ['url' => '1'];
$results = $CM_Client->events($params);

// Groups
$params  = ['url' 			  => 'records',
			'church_id'       => '1',     // Optional
			'tag_id'          => '1',     // Optional
			'start_time'      => '1',     // Optional
			'end_time'        => '1',     // Optional
			'start_week'      => '1',     // Optional
			'end_week'        => '1',     // Optional
			'category_id'     => '1',     // Optional
			'event_id'        => '1',     // Optional
			'campus_id'       => '1',     // Optional
			'week_reference'  => '5275']; // Optional
$params  = ['url' 			  => 'churches',
			'church_id'       => '1',     // Optional
			'tag_id'          => '1',     // Optional
			'pagination'      => true,
			'page'            => '1'];
$params  = ['url'			  => 'tags',
			'church_id'       => '1',     // Optional
			'tag_id'          => '1'];    // Optional
$results = $CM_Client->groups($params);

// Organizations
$params  = ['url' 			 => 'me'];
$params  = ['url' 			 => 'weekly_totals',
			'category_id'    => '1', // Required
			'week_reference' => '5275']; //Optional
$results = $CM_Client->organizations($params);

// Projections
$params  = ['pagination' => true,
			'page'       => '1',
			'category_id'=> '1',
			'campus_id'  => '1',
			'start_week' => '1',
			'end_week'   => '1'];
$params  = ['url'        => '1'];
$results = $CM_Client->projections($params);

// Records
$params  = ['url'			 => '1',
			'pagination'     => true,
			'page'           => '1',
			'start_time'     => '1',
			'end_time'       => '1',
			'start_week'     => '1',
			'end_week'       => '1',
			'category_id'    => '1',
			'event_id'       => '1',
			'campus_id'      => '1',
			'week_reference' => '1'];
$params  = ['url'            => '1'];
$results = $CM_Client->records($params);

// Regions
$params  = [];
$params  = ['url' => '1'];
$results = $CM_Client->regions($params);

// Service Times
$params  = ['pagination' => true,
			'page'       => '1',
			'event_id'   => '1']; // Optional
$params  = ['url'        => '1'];
$results = $CM_Client->service_times($params);

// Users
$params  = [];
$params  = ['url' => '1'];
$results = $CM_Client->users($params);