Overview

Namespaces

  • Crunchmail
    • Collections
    • Entities
    • Exception
    • PHPUnit
    • Resources

Classes

  • Client
  • Overview
  • Namespace
  • Class

Class Client

Crunchmail\Client main class

GuzzleHttp\Client
Extended by Crunchmail\Client
Namespace: Crunchmail
Located at Client.php
Methods summary
public object
# __construct( array $config = [] )

Initilialize the client, extends guzzle constructor

Initilialize the client, extends guzzle constructor

Parameters

$config
API configuration

Returns

object
public Crunchmail\Resources\GenericResource
# __get( string $name )

Create a resource when accessing client properties and returns it

Create a resource when accessing client properties and returns it

Example: $client->messages $messageEntity->recipients

Parameters

$name
property

Returns

Crunchmail\Resources\GenericResource
public mixed
# createResource( string $name, string $url = '' )

Create a resource depending on name

Create a resource depending on name

If a specific class exists for this type of ressource (ie: attachmentResource) then it will be used.

Forcing an url is usefull when creating a sub-resource from an entity object, because the base url is then specific

Parameters

$name
name of the resource (ie: attachments)
$url
force an url for the resource

Returns

mixed
public string
# mapPath( string $path )

Convert resource path if map is found, path otherwise

Convert resource path if map is found, path otherwise

Parameters

$path

Returns

string
public
# apiRequest( $method, $url = '', $values = [], $filters = [] )
public string
# getTokenFromCredentials( string $identifier, string $password )

Return an auth token from credentials

Return an auth token from credentials

Parameters

$identifier
login
$password
password

Returns

string
public string
# getToken( array $params = null )

Return an auth token from given parameters

Return an auth token from given parameters

Parameters

$params
parameters to post

Returns

string
protected null
# catchGuzzleException( mixed $exc )

Catch all guzzle exception types and execute proper action

Catch all guzzle exception types and execute proper action

Parameters

$exc
$e guzzle exception

Returns

null
Properties summary
public static array $paths

Allowed paths and mapping to api resource path ex: $client->recipients will access path /mails

Allowed paths and mapping to api resource path ex: $client->recipients will access path /mails

# [ 'recipients' => 'mails', "optouts" => 'opt-outs' ]
public static array $entities

Plural / Singular names of entites This is used to generate class name that need singular form

Plural / Singular names of entites This is used to generate class name that need singular form

# [ 'categories' => 'category', 'preview' => 'preview', 'lists' => 'contactList' ]
public static array $methods

List of authorized methods on client. ex: $client->get($url);

List of authorized methods on client. ex: $client->get($url);

# [ 'get', 'delete', 'head', 'options', 'patch', 'post', 'put' //'request' // request is disable for now, not implemented ]
public string $format

Default request format

Default request format

Param

string
# 'json'
public array $headers

Default headers

Default headers

Param

array
# []
API documentation generated by ApiGen