PHPackages                             spinegar/sugar7wrapper - 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. spinegar/sugar7wrapper

ActiveLibrary

spinegar/sugar7wrapper
======================

SugarCRM REST Client

v2.0.0(7y ago)5156.6k44[3 issues](https://github.com/spinegar/sugarcrm7-api-wrapper-class/issues)1PHPPHP &gt;=7.2

Since Oct 3Pushed 7y ago14 watchersCompare

[ Source](https://github.com/spinegar/sugarcrm7-api-wrapper-class)[ Packagist](https://packagist.org/packages/spinegar/sugar7wrapper)[ RSS](/packages/spinegar-sugar7wrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (1)

SugarCRM REST Client For SugarCRM 7
===================================

[](#sugarcrm-rest-client-for-sugarcrm-7)

License: MIT

Contents
--------

[](#contents)

About Installation Usage Example Custom and/or Undefined Endpoints Troubleshooting

About
-----

[](#about)

A simple PHP library interacting with the SugarCRM v10 or later REST API.

v2.0.0
------

[](#v200)

v2.0.0 provides some minor updates to keep the library up to date with the PHP ecosystem.

- The namespace has been updated to avoid versioning confusion with Sugar. You will be required to update the namespace to `\Spinegar\SugarRestClient\Rest` to instantiate the library.
- Support for Guzzle 6 has been added.
- The `connect` method has been deprecated and is now handled by the library when interacting with the Sugar API.

Installation via Composer
-------------------------

[](#installation-via-composer)

Edit composer.json

```
{
	"require": {
		"spinegar/sugar7wrapper": "^v2.0.0"
	}
}
```

Then install with composer

```
$ composer install
```

3.Usage Examples
----------------

[](#3usage-examples)

```
/* Instantiate and authenticate */
$sugar = new \Spinegar\SugarRestClient\Rest();

$sugar->setUrl('https://sugar/rest/v11/')
	->setUsername('user')
	->setPassword('password');

/* Instantiate and authenticate for a specific platform*/
$sugar->setUrl('https://sugar/rest/v11/')
    ->setUsername('user')
    ->setPassword('password')
    ->setPlatform('api');

/* Retrieve all records in the Cases module */
$sugar->search('Cases');

/* Retrieve all records in the Cases module where the name = 'Case1 Name' or 'Case2 Name' */
$sugar->search('Cases', array(
	'q' => '"Case1 Name" "Case2 Name"'
));

/* Retrieve the name field for all records in the Cases module */
$sugar->search('Cases', array(
	'fields' => 'name'
));

/* Retrieve all records with filter params in the Contacts module */
$sugar->filter('Contacts', array(
    'filter' => array(
        array('first_name' => 'First Name'),
    )
));

/* Count all records with filter params in the Cases module */
$sugar->countRecords('Cases', array(
    'filter' => array(
        array('status' => 'New'),
    )
));

/* Retrieve a specific record from the Cases module */
$sugar->retrieve('Cases', $record_id);

/* Create a case */
$sugar->create('Cases', array(
	'name' => 'Case Name',
	'status' => 'Assigned'
));

/* Update a case */
$sugar->update('Cases', $record_id, array(
    	'status' => 'Closed'
));

/* Favorite a case */
$sugar->favorite('Cases', $record_id);

/* Unfavorite a case */
$sugar->unfavorite('Cases', $record_id);

/* Retrieve cases related to an account */
$sugar->related('Accounts', $record_id, 'cases');

/* Relate a case to an account */
$sugar->relate('Accounts', $record_id, 'cases', $related_record_id);

/*Relate a contact to an opportunity and set relationship data */
$sugar->relate('Opportunities', $record_id, 'contacts', $related_record_id, array(
	'contact_role' => 'Influencer'
));

/* Delete relationship between an account and case */
$sugar->unrelate('Accounts', $record_id, 'cases', $related_record_id);

/* Update relationship data */
$sugar->updateRelationship('Opportunities', $record_id, 'contacts', $related_record_id, array(
	'contact_role' => 'Influencer'
));

/* Retrieve a list of attachments for a case */
$attachments = $sugar->related('Cases', $record_id, 'notes');

foreach($attachments['records'] as $attachment)
{
	$output[] = $sugar->files('Notes', $attachment['id']);
}

return $output;

/* Delete the file associated to the filename field of a note */
$sugar->deleteFile('Notes', $record_id, 'filename');

/* Download  the file associated to the filename field of a note to the server */
$sugar->download('Notes', $record_id, 'filename', '/path/to/destination.ext');

/* Upload a file associated to the filename field of a note to the server */
$sugar->upload('Notes', $record_id, 'filename', '/path/of/local/file.ext');
```

4. Custom &amp; Undefined Endpoints

---

Call custom or undefined endpoints using the following methods.

```
/* Get Endpoint*/
$parameters = array();
$sugar->getEndpoint('MyCustomEndpoint', $parameters);

/* Post Endpoint*/
$parameters = array();
$sugar->postEndpoint('MyCustomEndpoint', $parameters);

/* Put Endpoint*/
$parameters = array();
$sugar->putEndpoint('MyCustomEndpoint', $parameters);

/* Delete Endpoint*/
$parameters = array();
$sugar->deleteEndpoint('MyCustomEndpoint', $parameters);
```

5. Troubleshooting

---

If you are having trouble connecting to a secured site (https), try the following:

```
$sugar = new \Spinegar\Sugar7Wrapper\Rest();
$sugar->setClientOption('verify', false); // This is the important part
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 68.2% 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.

###  Release Activity

Cadence

Every ~794 days

Total

2

Last Release

2580d ago

Major Versions

v1.0 → v2.0.02019-04-16

PHP version history (2 changes)v1.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/934c3bdba596274dab4248e741ba2fc3ee651604ed521fd9ae23165d4beb89cf?d=identicon)[spinegar](/maintainers/spinegar)

---

Top Contributors

[![spinegar](https://avatars.githubusercontent.com/u/2236579?v=4)](https://github.com/spinegar "spinegar (58 commits)")[![spenserhale](https://avatars.githubusercontent.com/u/5643366?v=4)](https://github.com/spenserhale "spenserhale (5 commits)")[![startupz](https://avatars.githubusercontent.com/u/310652?v=4)](https://github.com/startupz "startupz (4 commits)")[![cmourizard](https://avatars.githubusercontent.com/u/295190?v=4)](https://github.com/cmourizard "cmourizard (4 commits)")[![jlyons-bgl](https://avatars.githubusercontent.com/u/25048418?v=4)](https://github.com/jlyons-bgl "jlyons-bgl (2 commits)")[![nickescobedo](https://avatars.githubusercontent.com/u/2837169?v=4)](https://github.com/nickescobedo "nickescobedo (2 commits)")[![esimonetti](https://avatars.githubusercontent.com/u/1671865?v=4)](https://github.com/esimonetti "esimonetti (2 commits)")[![bountin](https://avatars.githubusercontent.com/u/208063?v=4)](https://github.com/bountin "bountin (2 commits)")[![thomasez](https://avatars.githubusercontent.com/u/683490?v=4)](https://github.com/thomasez "thomasez (1 commits)")[![cmoore4](https://avatars.githubusercontent.com/u/311193?v=4)](https://github.com/cmoore4 "cmoore4 (1 commits)")[![denheck](https://avatars.githubusercontent.com/u/235116?v=4)](https://github.com/denheck "denheck (1 commits)")[![huhwatnou](https://avatars.githubusercontent.com/u/4171421?v=4)](https://github.com/huhwatnou "huhwatnou (1 commits)")[![mattstauffer](https://avatars.githubusercontent.com/u/151829?v=4)](https://github.com/mattstauffer "mattstauffer (1 commits)")[![askhogan](https://avatars.githubusercontent.com/u/635449?v=4)](https://github.com/askhogan "askhogan (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spinegar-sugar7wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/spinegar-sugar7wrapper/health.svg)](https://phpackages.com/packages/spinegar-sugar7wrapper)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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