Properties

$wsdl

$wsdl : string

An absolute URL to the MinistryPlatform API endpoint.

Type

string

$guid

$guid : string

The MinistryPlatform Domain GUID.

Type

string

$pw

$pw : \Blackpulp\MinistryPlatform\[type]

The MinistryPlatform API Password.

Type

\Blackpulp\MinistryPlatform\[type]

$servername

$servername : string

The server name (mp.example.com).

Type

string

$params

$params : array

SOAP Client parameters.

Type

array

$client

$client : \SoapClient

An instance of the SOAP Client class

Type

\SoapClient

$errors

$errors : array

An array of any errors returned by the API call.

Type

array

$results

$results : array

An array containing the results of an API call.

Type

array

$user_id

$user_id : integer

The ID of the authenticated MP User. Used for audit logging.

Type

integer

Methods

configureConnection()

configureConnection() : void

Set up the Connection Object for use with the SoapClient class.

__construct()

__construct(integer  $user_id) 

Initialize the MinistryPlatform Object

Parameters

integer $user_id

the User_ID who is performing the API calls. This is used for Audit Logging in MinistryPlatform.

authenticate()

authenticate(  $username, string  $password) : \Blackpulp\MinistryPlatform\User

Authenticate a user via MinistryPlatform.

Parameters

$username
string $password

This is the non-hashed password value.

Returns

\Blackpulp\MinistryPlatform\User

authenticateGuid()

authenticateGuid(  $guid) 

Parameters

$guid

storedProcedure()

storedProcedure(string  $sp, array  $request = array()) : \Blackpulp\MinistryPlatform\StoredProcedureResult

Execute a stored procedure.

Parameters

string $sp

The name of the stored procedure.

array $request

An array of Stored Procedure parameters

Returns

\Blackpulp\MinistryPlatform\StoredProcedureResult

makeRecord()

makeRecord(string  $table, string  $primary_key, array  $fields) : \Blackpulp\MinistryPlatform\Record

Create a new MinistryPlatform record object.

Parameters

string $table

The name of the database table

string $primary_key

The field name of the specified table's primary key.

array $fields

An array of field names and their values

Returns

\Blackpulp\MinistryPlatform\Record

makeTable()

makeTable(string  $name, string  $primary_key) : \Blackpulp\MinistryPlatform\Table

Create a MinistryPlatform Table object.

Parameters

string $name

The name of the database table

string $primary_key

The field name of the specified table's primary key.

Returns

\Blackpulp\MinistryPlatform\Table

makeFile()

makeFile(string  $file_name, string  $temp_name, string  $description, integer  $page_id, integer  $record_id, boolean  $is_image, integer  $pixels) : \Blackpulp\MinistryPlatform\File

Create a MinistryPlatform File object. Used for attaching files.

Parameters

string $file_name

The name of the file as it will be saved into MinistryPlatform.

string $temp_name

The absolute physical path of the temp file's name.

string $description

A description of the file.

integer $page_id

The Page_ID value of the Record's Table in MinistryPlatform.

integer $record_id

The ID of the Record the file will be attached to in MinistryPlatform.

boolean $is_image

Simple boolean to determine whether the file is an image.

integer $pixels

Number of pixels to resize the longest side of an image. Use 0 to retain the original dimensions.

Returns

\Blackpulp\MinistryPlatform\File

addRecord()

addRecord(\Blackpulp\MinistryPlatform\Record  $record) : array

Add Record call to MinistryPlatform.

Parameters

\Blackpulp\MinistryPlatform\Record $record

Returns

array

updateRecord()

updateRecord(\Blackpulp\MinistryPlatform\Record  $record) : array

Update Record call to MinistryPlatform.

Parameters

\Blackpulp\MinistryPlatform\Record $record

Returns

array

createRecurringSeries()

createRecurringSeries(\Blackpulp\MinistryPlatform\RecurringRecord  $recurring_record) : array

Create a set of recurring records in MinistryPlatform

Parameters

\Blackpulp\MinistryPlatform\RecurringRecord $recurring_record

Returns

array

getFirstDateInSeries()

getFirstDateInSeries(\Blackpulp\MinistryPlatform\RecurringRecord  $recurring_record) : array

Get the first date of a recurring series.

Parameters

\Blackpulp\MinistryPlatform\RecurringRecord $recurring_record

Returns

array —

$results

getRecurringRecords()

getRecurringRecords(\Blackpulp\MinistryPlatform\RecurringRecord  $recurring_record) : \Blackpulp\MinistryPlatform\StoredProcedureResult

Get a list of each recurring date in a RecurringRecord object.

Retrieve two tables of information from MinistryPlatform based on the values of a RecurringRecord object. First, get back a table with a date representing every instance of the series. Second, get back a one-sentence description of the series (i.e. Every Tuesday from 1/1/2015 to 12/31/2015).

Parameters

\Blackpulp\MinistryPlatform\RecurringRecord $recurring_record

Returns

\Blackpulp\MinistryPlatform\StoredProcedureResult

attachFile()

attachFile(\Blackpulp\MinistryPlatform\File  $file) : array

Attach a file to a record in MinistryPlatform.

Parameters

\Blackpulp\MinistryPlatform\File $file

Returns

array

updateDefaultImage()

updateDefaultImage(\Blackpulp\MinistryPlatform\File  $file) : array

If the current file is an image, makes that image the Record's default.

Parameters

\Blackpulp\MinistryPlatform\File $file

Returns

array

SplitToArray()

SplitToArray(string  $string) : array

Convert a pipe delimited string to an array.

Several MinistryPlatform API calls return a pipe-delimited string. This method is used to quickly split that string into an array.

Parameters

string $string

The pipe delimited string.

Returns

array —

$array

formatSoapDateTime()

formatSoapDateTime(string  $timestamp) : string

Convert the format of a datetime string.

This is used to allow datetime strings to be sent from PHP to the SOAP XML API where a datetime data type is required.

Parameters

string $timestamp

Any datetime string

Returns

string —

A different datetime string

execute()

execute(string  $function, array  $parameters) : \Blackpulp\MinistryPlatform\SimpleXMLObject

Execute the API call.

Responsible for sending the MinistryPlatform API call and returning the response.

Parameters

string $function

The name of the API method

array $parameters

Returns

\Blackpulp\MinistryPlatform\SimpleXMLObject

ConvertToString()

ConvertToString(array  $array) : string

Convert an array to a request string.

This method converts arrays of data into a simple request string. In the process, it also preps strings for insertion into MP by replacing specific characters with MP-approved equivalents.

Parameters

array $array

Returns

string —

Request String in the format of foo=bar&foo2=bar2.