This library is for integration with Salesforce via REST API.

Last update: Apr 17, 2022

xsolve-pl/salesforce-client

Build Status Scrutinizer Code Quality Code Coverage

Introduction

This library is for integration with Salesforce via REST API.

Licence

This library is under the MIT license. See the complete license in LICENSE file.

Getting started

Add the library to your project using Composer as follows:

$ composer require xsolve-pl/salesforce-client

We are using http://httplug.io/, so you can use any of existing adapters, for example:

$ composer require php-http/guzzle6-adapter

Otherwise you need to create your own implementation.

To store access token we have implemented BlaBlaCarRedis token storage, but it needs blablacar/redis-client

$ composer require blablacar/redis-client "~1.0"

Another option for token storage is RequestTokenStorage (this will keep the token in own property (memory) so the token would last until the script is terminated (e.g. current request), which is not really effective). Of course you can create your own storage, everything what you need to do is to create a class which implements Xsolve\SalesforceClient\Storage\TokenStorageInterface

Documentation

Documentation is available in the doc directory. Read documentation

GitHub

https://github.com/boldare/salesforce-client
Comments
  • 1. Move authentication request to dedicated class

    In order to have all the requests being sent to the Salesforce API stored in unified manner we could research if it's possible to move Authenticator::getRequest() logic to separate class which would implement RequestInterface like all other requests.

    Reviewed by Kryniol at 2017-01-23 11:13
  • 2. Inconsistent docblocks and return type declarations

    Sometimes a return type is specified and other times it is not.

    For example, no return type here even though it has to be a bool. https://github.com/xsolve-pl/salesforce-client/blob/master/src/Model/Account.php#L363 Btw. PHP 7 doesn't allow returning nulls when you have a return type declared.

    On the other hand this has a return type, but no docblock https://github.com/xsolve-pl/salesforce-client/blob/master/src/Model/Account.php#L648

    Is this by choice? I can understand no docblocks for simple methods with type declarations, but here it's pretty inconsistent.

    Reviewed by krzysztof-ciszewski at 2017-01-17 13:37
  • 3. Error invalid_grant when doing doRequest

    Hello,

    I'm following the documentation but I cannot make any doRequest, all I get is the following :

    In Authenticator.php line 44:
                                      
      Authentication request failed.  
                                      
    
    In Promise.php line 127:
                                                                                                                        
      Client error: `POST https://test.salesforce.com/services/oauth2/token` resulted in a `400 Bad Request` response:  
      {"error":"invalid_grant","error_description":"authentication failure"}                                            
                                                                                                                        
    
    In RequestException.php line 113:
                                                                                                                        
      Client error: `POST https://test.salesforce.com/services/oauth2/token` resulted in a `400 Bad Request` response:  
      {"error":"invalid_grant","error_description":"authentication failure"}                                            
    

    Here is my code :

            $client = new GuzzleAdapter(new Client([
                'base_uri' => 'https://test.salesforce.com/',
            ]));
    
            $securityToken = 'XXXXXX';
    
            $credentials = new Credentials(
                'MY_KEY',
                'MY_SECRET',
                'password',
                [
                    'username' => 'MY_ACCOUNT',
                    'password' => 'MY_PASSWORD'.$securityToken,
                ]
            );
    
            $authenticator = new Authenticator(
                $client,
                [new PasswordGrantRegenerateStrategy()]
            );
    
            $tokenGenerator = new TokenGenerator(
                $credentials,
                $authenticator,
                new RequestTokenStorage()
            );
    
            $salesforceClient = new SalesforceClient($client, $tokenGenerator, 'v37.0');
    
            // print_r($salesforceClient);
    
            $result = $salesforceClient->doRequest(new Query('SELECT Name FROM Account'));
    

    I do not understand where the error come from, can you help me?

    Reviewed by Err0r404 at 2019-05-16 13:17
  • 4. Mysterious prefix

    We should use full name "Salesforce" instead of "S" prefix in all places. We can also try to remove that part as we have namespaces which tell what's the class' context.

    Reviewed by Kryniol at 2017-01-04 14:27
  • 5. Invalid dependency in composer.json

    In https://github.com/xsolve-pl/salesforce-client/blob/master/composer.json the Guzzle lib is in the suggest section but actually it's required and without it the API client won't work at all as we don't have any other implementations of the client.

    Reviewed by Kryniol at 2017-01-04 15:13
  • 6. Wrong parent class for NotFoundException

    It seems to me that NotFoundException has nothing in common with AuthorizationFailedException. https://github.com/xsolve-pl/salesforce-client/blob/master/Security/Authentication/Strategy/NotFoundException.php

    Reviewed by Kryniol at 2017-01-04 14:48
  • 7. Create value objects

    I guess https://github.com/xsolve-pl/salesforce-client/blob/master/Model/Address.php isn't really a standalone model which could be used by the Salesforce object repository but it's rather a value object which aggregates multiple scalars from the same context. For that I'd create separate ValueObject namespace within the Xsolve\SalesforceClient\Model\ one.

    Reviewed by Kryniol at 2017-01-04 14:40
  • 8. Run CI builds on newer PHP versions

    Travis CI can be configured to execute its builds on different PHP versions. As PHP7.0 slowly becomes obsolete (it's not supported since 3.12.2017 and gets only security fixes) I think we should start analysing the codebase against newer versions. Moreover, we require PHP >7.0.0 in composer.json so it would be great to have some confirmation the code works well on newer ones as well.

    Reviewed by Kryniol at 2018-01-19 11:14
  • 9. Remove code duplications reported by Scrutinizer

    Link to report: https://scrutinizer-ci.com/g/xsolve-pl/salesforce-client/issues/master?selectedLabels%5B0%5D=4&orderField=path&order=asc&honorSelectedPaths=0

    Reviewed by adrianwaler at 2017-01-23 12:01
  • 10. Scrutinizer - improve code coverage of ExpressionFactory

    https://scrutinizer-ci.com/g/xsolve-pl/salesforce-client/code-structure/master/class/Xsolve%5CSalesforceClient%5CQueryBuilder%5CExpr%5CExpressionFactory

    Reviewed by Kryniol at 2017-01-23 10:54
  • 11. Scrutinizer - duplicated method in QueryBuilder

    see https://scrutinizer-ci.com/g/xsolve-pl/salesforce-client/issues/master/files/src/QueryBuilder/QueryBuilder.php?selectedLabels%5B0%5D=4&orderField=path&order=asc&honorSelectedPaths=0#inspectioncomment-60883939

    see https://scrutinizer-ci.com/g/xsolve-pl/salesforce-client/issues/master/files/src/QueryBuilder/QueryBuilder.php?selectedLabels%5B0%5D=4&orderField=path&order=asc&honorSelectedPaths=0#inspectioncomment-60883940

    Reviewed by Kryniol at 2017-01-20 13:37
  • 12. composer error trying to get the correct compatable versions

    I'm getting this error after fixing the guzzle6-adapter issue earlier. Not getting this to work.

    Problem 1 - php-http/guzzle6-adapter is locked to version v2.0.1 and an update of this package was not requested. - xsolve-pl/salesforce-client[1.0.0, ..., v1.0.3] require php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0]. - Conclusion: don't install php-http/httplug v1.1.0 (conflict analysis result) - Root composer.json requires xsolve-pl/salesforce-client ^1.0 -> satisfiable by xsolve-pl/salesforce-client[1.0.0, v1.0.1, v1.0.2, v1.0.3].

    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

    No luck with composer require xsolve-pl/salesforce-client -W either

    Reviewed by inpresif at 2021-02-14 18:33
  • 13. Update GitHub hooks for Packagist

    The services which link Packagist to the repository are deprecated:

    This package is using the legacy GitHub service and will stop being auto-updated in early 2019. Please set up the new GitHub Hook for Packagist so that it keeps working in the future.

    The repository should be updated following the Packagist documentation linked above.

    Reviewed by Kryniol at 2019-02-01 15:52
  • 14. Update URLs in the documentation

    After migrating to the boldare namespace all the URLs in the documentation, especially the ones for badges should be updated. Moreover, the Scrutinizer project should be migrated accordingly.

    Reviewed by Kryniol at 2019-02-01 15:48
This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP
This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

Jun 27, 2022
A PHP library for communicating with the Twilio REST API and generating TwiML.

twilio-php The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio API c

Jun 22, 2022
PHP library to use IOTA REST API to help node management and tangle queries

iota.php About PHP library to use IOTA REST API to help node management and tangle queries. Please be aware that this library is in an early developme

Feb 9, 2022
Nexmo REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Client Library for PHP Support Notice This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintena

May 27, 2022
PHP package for the Limg.app website - allowing to upload images via the API of the website.
PHP package for the Limg.app website - allowing to upload images via the API of the website.

Limg PHP Client Package. Installation You can install the package via composer: composer require havenstd06/limg-php-client Usage use Havenstd06\Limg\

Jul 27, 2021
Twitter REST API for PHP 5.3+

README The Wid'op Twitter REST library is a modern PHP 5.3+ API allowing you to easily interact with Twitter 1.1. In order to sign your request with t

Aug 10, 2020
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Jun 29, 2022
Interacting with Mastodon's REST API for Kirby v3

Kirby3 Mastodon This plugin provides access to your Mastodon statuses, called 'toots'. Getting started Use one of the following methods to install & u

Jan 17, 2022
Пакет позволяющий работать с REST API SMS-сервиса «SMS Aero»

SMS-сервис «SMS Aero» ?? Пакет позволяющий работать с REST API SMS-сервиса «SMS Aero» ?? Изменения: Все заметные изменения в этом проекте будут задоку

Feb 6, 2022
ProcessTranslatePage – A Processwire module to translate all page fields via Fluency

ProcessTranslatePage – A Processwire module to translate all page fields via Fluency ProcessTranslatePage is an extension for the Processwire module F

Dec 16, 2021
PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Feb 14, 2022
A links dashboard which can be integrated via HTML into various other systems.

quickdash Newest QuickDash version. Combines the API and Client repositories. Requirements PHP version 7.4 - https://www.php.net/ Composer - https://g

Mar 29, 2022
BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

May 18, 2022
PHP library for the Stripe API.

Stripe PHP bindings The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a p

Jul 2, 2022
A PHP library for the Campaign Monitor API

createsend A PHP library which implements the complete functionality of the Campaign Monitor API. Installation Composer If you use Composer, you can r

Jun 8, 2022
PHP 5.3+ library which helps you to interact with the DigitalOcean API

DigitalOcean The version 2 of the API will be available soon ! Please visit DigitalOceanV2 and contribute :) This PHP 5.3+ library helps you to intera

Jan 9, 2022
PHP library for the GitHub API v3

GitHub API v3 - PHP Library Currently under construction. Overview Provides access to GitHub API v3 via an Object Oriented PHP library. The goal of th

Jan 13, 2021
PHP library for the ArvanCloud API

PHP ArvanCloud API PHP library for the ArvanCloud API. This package supports PHP 7.3+. For Laravel integration you can use mohammadv184/arvancloud-lar

Apr 29, 2022
Upload Vimeo video with CodeIgniter, Official PHP library for the Vimeo API

Upload Vimeo video with CodeIgniter, Official PHP library for the Vimeo API. Vimeo Video upload with API using Official PHP library for the Vimeo API.

Oct 10, 2021