PHPackages                             lionixevolve/graphqlsuitecrm - 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. lionixevolve/graphqlsuitecrm

ActiveLibrary[API Development](/categories/api)

lionixevolve/graphqlsuitecrm
============================

GraphQL support for SuiteCRM / SugarCRM CE

v0.13.4(4y ago)202262AGPL-3.0-or-laterJavaScript

Since Nov 4Pushed 4y ago7 watchersCompare

[ Source](https://github.com/lionixevolve/GraphQLSuiteCRM)[ Packagist](https://packagist.org/packages/lionixevolve/graphqlsuitecrm)[ RSS](/packages/lionixevolve-graphqlsuitecrm/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (39)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/75d7b05ece1a595464d5691e7b13093df8b16ee6400a361a8b74f7b732bda456/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e697865766f6c76652f6772617068716c737569746563726d2f762f737461626c65)](https://packagist.org/packages/lionixevolve/graphqlsuitecrm) [![Total Downloads](https://camo.githubusercontent.com/117586bd33f33951d2a1e48930e1b756d6c6faa0d39a43f4c8407bfbc397614e/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e697865766f6c76652f6772617068716c737569746563726d2f646f776e6c6f616473)](https://packagist.org/packages/lionixevolve/graphqlsuitecrm) [![Latest Unstable Version](https://camo.githubusercontent.com/f20aba4c11f19c4e6d483aad602e7f5dcfb4790515b095e0ebcaa6399d205e6e/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e697865766f6c76652f6772617068716c737569746563726d2f762f756e737461626c65)](https://packagist.org/packages/lionixevolve/graphqlsuitecrm) [![License](https://camo.githubusercontent.com/0b9d091929732701c49c14c4736541e0236a8526b3a707d64703114cfdb99425/68747470733a2f2f706f7365722e707567782e6f72672f6c696f6e697865766f6c76652f6772617068716c737569746563726d2f6c6963656e7365)](https://packagist.org/packages/lionixevolve/graphqlsuitecrm)

UPCOMING NEW VERSION SuiteCRM 8 will have GraphQL natively so only bugfixes and minor features!
===============================================================================================

[](#upcoming-new-version-suitecrm-8-will-have-graphql-natively-so-only-bugfixes-and-minor-features)

Current code works well with SuiteCRM rest API. .

But I am already developing next version based on a much stronger PHP-GraphQL library webonyx/graphql. It is coming along nicely, has better performance, and I am using 100% V8 API endpoints (oauth-tokens instead of cookies).

GraphQLSuiteCRM
===============

[](#graphqlsuitecrm)

Use GraphQL instead of REST API to access SuiteCRM data. Production ready. Supports custom modules and custom REST endpoints with or without authentication. Can be integrated with SuiteCRM v8 API to be used with its native authentication.

What it does
------------

[](#what-it-does)

This package allows to use GraphQL with SuiteCRM (8.x / 10.x) /SugarCRM (6.5) instead of the Rest API which is not truly REST.

Upong installation a graphql endpoint will be created `vendor/lionixevolve/graphqlsuitecrm/rest.php/graphql` and you can hit it with queries if you are authenticated on SuiteCRM (using cookies)

There are more undocumented functions in the endpoint, like getting dropdown values.TODO: Document this

Once you send a query to rest.php/graphql it uses a PHP SuiteCRM Graphql schema based on Youshido/GraphQL library to process your query.

This GraphQL library uses SuiteCRM/SugarCRM beans for almost all the actions, so every logic hook you created or workflow, should work as planned.

Set up
------

[](#set-up)

`composer require lionixevolve/graphqlsuitecrm`

This will install the plugin in the vendor folder with all the requirements.

PHP extension php-intl its a requirement, for ubuntu install as `sudo apt-get install php-intl`

Testing and Usage
-----------------

[](#testing-and-usage)

GraphiQL is included in the package, to start using it open the web broser in `http://localhost/vendor/lionixevolve/graphqlsuitecrm/graphql/GraphiQL/` (adjust localhost to the suitecrm instance location) Use the included GraphiQL to try this

```
{
  accounts(limit:2) {
    name
  }
}

```

it will get you the accounts module with the name of each one. Limited to 2. You can also use the `offset:2` to paginate.

An advance example - retrieving all the cases by status. Also you can see some schema changes for the assigned\_user/created\_by users field that let you retrieve further information about the user.

```

 query cases( $status: String, $limit: String, $offset: String){
                                            cases( status: $status, offset:$offset, limit: $limit, order:"case_number" ){
                                                id
                                                case_number
                                                date_entered
                                                description
                                                status
                                                assigned_user_details{
                                                    id
                                                    first_name
                                                    last_name
                                                    user_name
                                                }
                                                created_user_details {
                                                    id
                                                    first_name
                                                    last_name
                                                    user_name
                                                }
                                                accounts {
                                                    name
                                                    id
                                                    contacts{
                                                        id
                                                    }
                                                }
                                            }
                                        }

```

As you can see related modules are also retrieved using the plural word of the relation. Accounts/Opportunities, etc.

### Extending/Customizing Suitecrm Graphql Schema

[](#extendingcustomizing-suitecrm-graphql-schema)

The library will load custom files from the `graphql` folder.

Two main files are loaded

1. `graphql/CustomSuiteCRMSchema.php`
2. `graphql/CustomRest.php`

the #1 will extend the included schema, for custom modules or even non-suitecrm related queries. the #2 will allow you to create your own REST endpoint calls, we use this for report generation where graphql resultset is not very efficient. (like using aggrid compatible resultset)

A full example of how to extend is below.

#### Extending the Schema -

[](#extending-the-schema--)

Here I am creating support for prospectlist which is not included (yet) in the main library.

This is extracted from a working setup

```
