Download the PHP package lionixevolve/graphqlsuitecrm without Composer
On this page you can find all versions of the php package lionixevolve/graphqlsuitecrm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lionixevolve/graphqlsuitecrm
More information about lionixevolve/graphqlsuitecrm
Files in lionixevolve/graphqlsuitecrm
Package graphqlsuitecrm
Short Description GraphQL support for SuiteCRM / SugarCRM CE
License AGPL-3.0-or-later
Informations about the package graphqlsuitecrm
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
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
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
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
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
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.
As you can see related modules are also retrieved using the plural word of the relation. Accounts/Opportunities, etc.
Extending/Customizing Suitecrm Graphql Schema
The library will load custom files from the graphql
folder.
Two main files are loaded
graphql/CustomSuiteCRMSchema.php
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 -
Here I am creating support for prospectlist which is not included (yet) in the main library.
This is extracted from a working setup
With these 2 files you will have QUERY support for ProspectLists (mutation os prospectlist itself is missing in this example)
Prospectlists is useful for segmenting audience, contacts, accounts and leads so the following mutation will relate the Bean and the prospect.
Customizing the Rest endpoint
- You can extend the rest (made with Slim) requests when the file
graphql/CustomRest.php
exists on your root suitecrm/lionixcrm folder
CORS
If you need support for CORS you may use the graphql/CustomRest.php
and include the following snippet
The CORS middleware will take care of allowing the specified hosts to access the API and return valid headers.
GraphiQL
You can use the included GraphiQL here:
vendor/lionixevolve/graphqlsuitecrm/graphql/GraphiQL/
Known Issues
- there is currently an issue with the schema inspector Issue#2
- Is currently checking ACL edit when saving the bean,
TODO
- Add missing modules (Quotes/Invoices/ProspectLists/etc)
- Migrate to the more active webonyx graphqlphp
All versions of graphqlsuitecrm with dependencies
gargron/fileupload Version ~1.4.0
youshido/graphql Version ^v1.5
monolog/monolog Version ^1.23