PHP library implementing the MiniCRM API https://www.minicrm.hu/help/minicrm-api/
^ codecov need to change to master once it is merged
-
GET: /Schema/Project/:project_id
Gets back the schema of a Project based on the given ID.
$client->getProjectSchema(int $projectId);
-
Gets back the schema of Person entities.
$client->getPersonSchema();
-
Gets back the schema of Business entities.
$client->getBusinessSchema();
-
Gets back an Address based on the given ID.
$client->getAddress(int $addressId);
-
Gets back the Address(es) of a given Person/Business. By providing the second parameter 'true' or 'false' you can decide whether you want to get the data structured or not. Default value is 'false'.
The field 'contactId' is mandatory in AddressRequest, see the Basic usage section, how to provide it.$client->getAddresses(AddressRequest $addressRequest, bool $structured = false);
-
Creates a new Address in MiniCRM database based on the provided field's values Fields 'contactId' and 'name' are mandatory, see the Basic usage section, how to provide it.
$client->createAddress(AddressRequest $addressRequest);
-
Updates an Address based on the given ID.
See the basic usage section how to provide the ID.Keep in mind if you provide a 'contactId' already in use, the method will update that particular contact with the given field's values.
$client->updateAddress(AddressRequest $addressRequest);
-
Gets back the existing Categories (Modules) of MiniCRM. By providing the second parameter 'true' or 'false' you can decide whether you want to het the data detailed or not. Default value is 'false'.
$client->getCategories(CategoryRequest $categoryRequest, bool $detailed = false);
-
Gets back a Person based on the given ID
$client->getPerson(int $contactId);
Gets back a Business based on the given ID
$client->getBusiness(int $contactId);
-
$client->createPerson(PersonRequest $personRequest);
Creates a new Person in MiniCRM database based on the provided field's values Field 'firstName' is mandatory, see the Basic usage section, how to provide it.
$client->createBusiness(BusinessRequest $businessRequest);
Creates a new Business in MiniCRM database based on the provided field's values. Field 'name' is mandatory, see the Basic usage section, how to provide it.
-
Updates a Person based on the given ID.
See the basic usage section how to provide the ID.$contact->updatePerson(PersonRequest $personRequest);
Updates a Business based on the given ID.
See the basic usage section how to provide the ID.$contact->updateBusiness(BusinessRequest $businessRequest);
-
Gets back a Project based on the given ID.
$client->getProject(int $projectId);
-
GET: /Project?CategoryId=:category_id
Gets back a Project based on the given CategoryID.
$client->getProjectsByCategoryId(int $categoryId);
-
GET: /Project?StatusGroup=:status_group
Gets back a Project based on the Status Group.
Status group values can be: 'Lead', 'Open', 'Success', 'Failed'.$client->getProjectsByStatusGroup(string $statusGroup);
-
Gets back Project based on the given UserID.
$client->getProjectsByUserId(int $userId);
-
Gets back a given Project's all emails based on the provided ID.
See the basic usage section how to provide the ID.$client->getProjectEmails(ProjectRequest $projectRequest);
-
Creates a new Project in MiniCRM database based on the provided field's values. Fields 'categoryId' and 'contactId' are mandatory, see the Basic usage section, how to provide it.
$client->createProject(ProjectRequest $projectRequest);
-
Updates a Project based on the given ID. See the basic usage section how to provide the ID.
$client->updateProject(ProjectRequest $projectRequest);
-
Gets back a ToDo based on the given ID.
$client->getTodo(int $todoId);
-
Gets back a Todos of a given Project based on the given ID.
$client->getTodoList(int $projectId);
-
Creates a new ToDo in MiniCRM database based on the provided field's values.
Field 'projectId' is mandatory, see the Basic usage section, how to provide it.$client->createToDo(TodoRequest $todoRequest);
-
Updates a ToDo based on the given ID. See the basic usage section how to provide the ID.
$client->updateTodo(TodoRequest $todoRequest);
-
Gets back a Template based on the given ID.
$client->getTemplate(int $templateId);
-
GET: /TemplateList/:category_id
Gets back a list of Templates according to a Category based on the given ID.
Field 'categoryId' is mandatory, see the Basic usage section, how to provide it.$client->getTemplateList(TemplateRequest $templateRequest);
The MiniCRM client uses separate endpoints as clients, so in order to use them, you need to pass a Guzzle client, and a Psr NullLogger to the given endpoint's constructor.
You will need:
- your
systemIdprovided by the url of MiniCRM when logged in. - your
apiKeyfrom MiniCrm - the
baseUrito decide whether you are using the client in a test environment or not- Test environment url: http://r3-test.minicrm.hu/
- Live environment url: http://r3.minicrm.hu/
<?php
use Cheppers\MiniCrm\DataTypes\Address\AddressRequest;
use Cheppers\MiniCrm\Endpoints\AddressEndpoint;
require __DIR__ . '/vendor/autoload.php';
$systemId = 'YOUR_SYSTEM_ID';
$apiKey = 'YOUR_API_KEY';
$baseUri = 'YOUR_URL';
$client = new \GuzzleHttp\Client();
$logger = new \Psr\Log\NullLogger();
$credentials = [
'baseUri' => $baseUri,
'apiKey' => $apiKey,
'systemId' => $systemId
];
$address = new AddressEndpoint($client, $logger);
$address->setCredentials($credentials);
// Printing out the Address with the ID: 1487.
print_r($address->getAddress(1487));
// Example for creating an Address.
print_r($address->createAddress(AddressRequest::__set_state([
'contactId' => 1,
'type' => 'Test Type', // Check the given types in MiniCRM. Use getSchema().
'name' => 'Test Address',
'countryId' => 'Test Country',
'postalCode' => 1,
'city' => 'Test City',
'county' => 'Test County',
'address' => 'Test Address',
'default' => 0
])));
// Providing fields when updating an address.
print_r($address->updateAddress(AddressRequest::__set_state([
'id' => 1,
'name' => 'updated-name',
])));To check available methods on endpoints, check above.