Skip to content

Commit

Permalink
Merge pull request #6 from PortoSpire/internal-version-sync-0.1.3.3
Browse files Browse the repository at this point in the history
Internal version sync 0.1.3.3
  • Loading branch information
criterion9 authored Mar 2, 2024
2 parents 5a2be62 + 4ff0639 commit 87e39c9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 45 deletions.
74 changes: 46 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,73 @@
<img src="https://assets.portospire.com/github.io/suitecrmclient.png" />
![SuiteCRM API Client](https://assets.portospire.com/github.io/suitecrmclient.png)

<img src="https://img.shields.io/github/v/release/PortoSpire/suiteCRMClient" /> <img src="https://img.shields.io/github/languages/code-size/PortoSpire/suiteCRMClient" /> <img src="https://img.shields.io/github/license/PortoSpire/suiteCRMClient" />
![Version](https://img.shields.io/github/v/release/PortoSpire/suiteCRMClient)
![Size](https://img.shields.io/github/languages/code-size/PortoSpire/suiteCRMClient)
![License](https://img.shields.io/github/license/PortoSpire/suiteCRMClient)
# Client library for use with SuiteCRM
A free (LGPL3) client library for use with SuiteCRM to abstract various API usage to enable easier integrations.
<a href="https://suitecrm.com/"><img src="https://assets.portospire.com/psf/img/suite_icon.png" alt="SuiteCRM" width="182" /></a>

<a href="https://www.portospire.com/">Provided by PortoSpire
<img src="https://assets.portospire.com/psf/img/portospire%20header.svg" alt="PortoSpire - be seen" width="182" /></a>
[Provided by PortoSpire
<img alt="PortoSpire - be seen" src="https://assets.portospire.com/psf/img/portospire%20header%20glow.svg" width="182" />](https://www.portospire.com)

[Introduction](#introduction)
[Setup](#setup)
[Usage](#usage)
* [Mezzio](#mezzio)
* [Laminas MVC](#laminasmvc)
* [Standalone](#standalone)

***

## Table of Contents ##
**[1. Introduction](#introduction)**
**[2. Setup](#setup)**
**[3. Usage](#usage)**
*[3.1. Mezzio](#mezzio)*
*[3.2. Laminas MVC](#laminasmvc)*
*[3.3. Standalone](#standalone)*

***

## <a name="introduction" href="#introduction">Introduction</a>
This package provides a SuiteCRM client to abstract API calls and form submissions to provide and receive
data from SuiteCRM instances. It makes use of Person Form campaigns and both the V8 and rest APIs as needed.

## <a name="setup" href="#setup">Setup</a>
Add to your project's composer.json
> composer require portospire/suitecrmclient

```bash
composer require portospire/suitecrmclient
```

## <a name="usage" href="#usage">Usage</a>
This package is built to support Laminas Mezzio and Laminas MVC as well
as be available as a stand alone library.

An example to get a list of Web campaigns from a SuiteCRM instance:
> $SuiteCRMClient->setServerDomain($server_domain);
> $SuiteCRMClient->setClientId($client_id);
> $SuiteCRMClient->setClientSecret($client_secret);
> $filter = new \PortoSpire\SuiteCRMClient\Model\Filter(['campaign_type' => 'Web']);
> $json = $SuiteCRMClient->getCampaigns([], ['size' => 20, 'number' => 1], 'name', $filter); // this will contain json of the results
> $campaignsFull = $SuiteCRMClient->convertJsonToGenerics($json); // this converts the json to PHP objects

```php
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$filter = new \PortoSpire\SuiteCRMClient\Model\Filter(['campaign_type' => 'Web']);
$json = $SuiteCRMClient->getCampaigns([], ['size' => 20, 'number' => 1], 'name', $filter); // this will contain json of the results
$campaignsFull = $SuiteCRMClient->convertJsonToGenerics($json); // this converts the json to PHP objects
```

An example to submit a lead into a web-to-lead form in a SuiteCRM instance:
(You can extend the provided models (Model/WebToLead, etc) if you have custom fields)
> $values = (array) $WebToLead; // expects an array of key=>value pairs where the keys match the different fields from the web-to-lead form
> $SuiteCRMClient->setServerDomain($server_domain);
> $SuiteCRMClient->setClientId($client_id);
> $SuiteCRMClient->setClientSecret($client_secret);
> $SuiteCRMClient->submitWebToLead($values, $campaign_id); // this must match the campaign id that the web-to-lead form is associated to in SuiteCRM

```php
$values = (array) $WebToLead; // expects an array of key=>value pairs where the keys match the different fields from the web-to-lead form
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$SuiteCRMClient->submitWebToLead($values, $campaign_id); // this must match the campaign id that the web-to-lead form is associated to in SuiteCRM
```

### <a name="mezzio" href="#mezzio">Mezzio</a>
Add the ConfigProvider class to the config aggregator (typically found in config/config.php)
> $aggregator = new ConfigAggregator([
> ...
> \PortoSpire\SuiteCRMClient\ConfigProvider::class,
> ...

```php
$aggregator = new ConfigAggregator([
...
\PortoSpire\SuiteCRMClient\ConfigProvider::class,
...
```

Then use the client in your handlers/middleware as needed for your use cases.


Expand Down
37 changes: 21 additions & 16 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
<img src="https://assets.portospire.com/github.io/suitecrmclient.png" />
![SuiteCRM API Client](https://assets.portospire.com/github.io/suitecrmclient.png)

<img src="https://img.shields.io/github/v/release/PortoSpire/suiteCRMClient" /> <img src="https://img.shields.io/github/languages/code-size/PortoSpire/suiteCRMClient" /> <img src="https://img.shields.io/github/license/PortoSpire/suiteCRMClient" />
![Version](https://img.shields.io/github/v/release/PortoSpire/suiteCRMClient)
![Size](https://img.shields.io/github/languages/code-size/PortoSpire/suiteCRMClient)
![License](https://img.shields.io/github/license/PortoSpire/suiteCRMClient)
# Client library for use with SuiteCRM
A free (LGPL3) client library for use with SuiteCRM to abstract various API usage to enable easier integrations.
<a href="https://suitecrm.com/"><img src="https://assets.portospire.com/psf/img/suite_icon.png" alt="SuiteCRM" width="182" /></a>

<a href="https://www.portospire.com/">Provided by PortoSpire
<img src="https://assets.portospire.com/psf/img/portospire%20header.svg" alt="PortoSpire - be seen" width="182" /></a>
[Provided by PortoSpire
<img alt="PortoSpire - be seen" src="https://assets.portospire.com/psf/img/portospire%20header%20glow.svg" width="182" />](https://www.portospire.com)

[Introduction](#introduction)
[Setup](#setup)
[Usage](#usage)
* [Mezzio](#mezzio)
* [Laminas MVC](#laminasmvc)
* [Standalone](#standalone)

***

## Table of Contents ##
**[1. Introduction](#introduction)**
**[2. Setup](#setup)**
**[3. Usage](#usage)**
*[3.1. Mezzio](#mezzio)*
*[3.2. Laminas MVC](#laminasmvc)*
*[3.3. Standalone](#standalone)*

***

## <a name="introduction" href="#introduction">Introduction</a>
This package provides a SuiteCRM client to abstract API calls and form submissions to provide and receive
data from SuiteCRM instances. It makes use of Person Form campaigns and both the V8 and rest APIs as needed.

## <a name="setup" href="#setup">Setup</a>
Add to your project's composer.json
````
````json
composer require portospire/suitecrmclient
````
## <a name="usage" href="#usage">Usage</a>
This package is built to support Laminas Mezzio and Laminas MVC as well
as be available as a stand alone library.

An example to get a list of Web campaigns from a SuiteCRM instance:
````
````php
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
Expand All @@ -40,7 +45,7 @@ $campaignsFull = $SuiteCRMClient->convertJsonToGenerics($json); // this converts
````
An example to submit a lead into a web-to-lead form in a SuiteCRM instance:
(You can extend the provided models (Model/WebToLead, etc) if you have custom fields)
````
````php
$values = (array) $WebToLead; // expects an array of key=>value pairs where the keys match the different fields from the web-to-lead form
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
Expand All @@ -49,7 +54,7 @@ $SuiteCRMClient->submitWebToLead($values, $campaign_id); // this must match the
````
### <a name="mezzio" href="#mezzio">Mezzio</a>
Add the ConfigProvider class to the config aggregator (typically found in config/config.php)
````
````php
$aggregator = new ConfigAggregator([
...
\PortoSpire\SuiteCRMClient\ConfigProvider::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
class Module
{

const VERSION = "0.1.3.2";
const VERSION = "0.1.3.3";
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
Expand Down

0 comments on commit 87e39c9

Please sign in to comment.