PHPackages                             asakusuma/sugarcrm-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. asakusuma/sugarcrm-wrapper

ActiveLibrary[API Development](/categories/api)

asakusuma/sugarcrm-wrapper
==========================

SugarCRM REST API Wrapper Class

9221.9k70[13 issues](https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class/issues)[3 PRs](https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class/pulls)PHP

Since Mar 10Pushed 4y ago15 watchersCompare

[ Source](https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class)[ Packagist](https://packagist.org/packages/asakusuma/sugarcrm-wrapper)[ RSS](/packages/asakusuma-sugarcrm-wrapper/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

SugarCRM REST API Wrapper Class
===============================

[](#sugarcrm-rest-api-wrapper-class)

by Asa Kusuma

License: MIT

Contents
--------

[](#contents)

1. About
2. Installation
3. Usage Example
4. Notes
5. get\_note\_attachment() Example
6. set\_note\_attachment() Example

1.About
-------

[](#1about)

- PHP wrapper class for interacting with a SugarCRM REST API
- Creating, reading, and updating capability
- More info on SugarCRM:
- API docs:
- Designed to work with SugarCRM v.6

2. Installation via Composer

---

Edit composer.json

```
{
	"repositories": [
			{
				"type": "vcs",
    			"url": "https://github.com/Daursu/curl"
    		}
		],
	"require": {
		"asakusuma/sugarcrm-wrapper": "dev-master"
	},
	"minimum-stability": "dev"
}

```

Then install with composer

```
$ composer install

```

3.Usage Example
---------------

[](#3usage-example)

```
$sugar = new \Asakusuma\SugarWrapper\Rest;

$sugar->setUrl('https://sugarcrm/service/v2/rest.php');
$sugar->setUsername('user');
$sugar->setPassword('password');

$sugar->connect();

$results = $sugar->get("Accounts",array('id','name'));

print_r($results);

```

See example.php for another example.

4.Notes
-------

[](#4notes)

- The `is_valid_id()` function may need to modify for different versions of SugarCRM.
- Different versions of SugarCRM have different ID formats.

5.get\_note\_attachment() Example
---------------------------------

[](#5get_note_attachment-example)

> This example outputs the contents of a note's attachment, given the note ID. Assumes $note\_id contains the ID of the note you wish to modify.

```
$sugar = new \Asakusuma\SugarWrapper\Rest;

$sugar->setUrl('https://sugarcrm/service/v2/rest.php');
$sugar->setUsername('user');
$sugar->setPassword('password');

$sugar->connect();

$result = $sugar->get_note_attachment($note_id);
$filename = $result['note_attachment']['filename'];
$file = $result['note_attachment']['file'];

$file = base64_decode($file);
header("Cache-Control: no-cache private");
header("Content-Description: File Transfer");
header('Content-disposition: attachment; filename='.$filename);
header("Content-Type: application/vnd.ms-excel");
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. strlen($file));
echo $file;
exit;

```

6.set\_note\_attachment() Example
---------------------------------

[](#6set_note_attachment-example)

> This example illustrates how to set a note's attachment from an html form. Assumes $note\_id contains the ID of the note you wish to modify.

### HTML Code

[](#html-code)

```

```

### PHP Code (example.php)

[](#php-code-examplephp)

```
$sugar = new \Asakusuma\SugarWrapper\Rest;

$sugar->setUrl('https://sugarcrm/service/v2/rest.php');
$sugar->setUsername('user');
$sugar->setPassword('password');

$sugar->connect();

if ($_FILES["note_file"]["error"] > 0) {
	// Error: $_FILES["file"]["error"]
} else if(isset($_FILES['note_file']['tmp_name']) && $_FILES['note_file']['tmp_name']!="") {
	$handle = fopen($_FILES['note_file']['tmp_name'], "rb");
	$filename = $_FILES['note_file']['name'];
	$contents = fread($handle, filesize($_FILES['note_file']['tmp_name']));
	$binary = base64_encode($contents);
	$file_results = $sugar->set_note_attachment($note_id,$binary,$filename);
}

```

7.get\_available\_modules() Example
-----------------------------------

[](#7get_available_modules-example)

> This example illustrates how to get the available modules in Sugar. All of them. This is a handy function to use when building future proof sugarcrm plugins.

### PHP Code (example.php)

[](#php-code-examplephp-1)

```
$sugar = new \Asakusuma\SugarWrapper\Rest;
$modules = $sugar->get_available_modules();

```

> BAM! Now loop through the array that was returned and stored in $modules. You could use this to display a dropdown in the admin panel that displays all modules a user would want to connect your sugarcrm plugin to.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/10dcd8477a94b7afa11ffdfc79ce57708073768d219aa51cf3f721bc6973ffcd?d=identicon)[asakusuma](/maintainers/asakusuma)

---

Top Contributors

[![asakusuma](https://avatars.githubusercontent.com/u/597574?v=4)](https://github.com/asakusuma "asakusuma (39 commits)")[![spinegar](https://avatars.githubusercontent.com/u/2236579?v=4)](https://github.com/spinegar "spinegar (14 commits)")[![Shotman](https://avatars.githubusercontent.com/u/6579166?v=4)](https://github.com/Shotman "Shotman (5 commits)")[![Kostanos](https://avatars.githubusercontent.com/u/1136702?v=4)](https://github.com/Kostanos "Kostanos (3 commits)")[![chadhutchins](https://avatars.githubusercontent.com/u/47898?v=4)](https://github.com/chadhutchins "chadhutchins (3 commits)")[![koyhoge](https://avatars.githubusercontent.com/u/49316?v=4)](https://github.com/koyhoge "koyhoge (2 commits)")[![filiptepper](https://avatars.githubusercontent.com/u/3822?v=4)](https://github.com/filiptepper "filiptepper (1 commits)")[![andarnold](https://avatars.githubusercontent.com/u/18539597?v=4)](https://github.com/andarnold "andarnold (1 commits)")[![KyleGawryluk](https://avatars.githubusercontent.com/u/3766614?v=4)](https://github.com/KyleGawryluk "KyleGawryluk (1 commits)")[![mjones517](https://avatars.githubusercontent.com/u/11433552?v=4)](https://github.com/mjones517 "mjones517 (1 commits)")[![samy](https://avatars.githubusercontent.com/u/1282106?v=4)](https://github.com/samy "samy (1 commits)")[![shano](https://avatars.githubusercontent.com/u/167567?v=4)](https://github.com/shano "shano (1 commits)")[![askhogan](https://avatars.githubusercontent.com/u/635449?v=4)](https://github.com/askhogan "askhogan (1 commits)")[![andreipdev](https://avatars.githubusercontent.com/u/1207190?v=4)](https://github.com/andreipdev "andreipdev (1 commits)")

### Embed Badge

![Health badge](/badges/asakusuma-sugarcrm-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/asakusuma-sugarcrm-wrapper/health.svg)](https://phpackages.com/packages/asakusuma-sugarcrm-wrapper)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
