This library is for integration with Salesforce via REST API.

Overview

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

Comments
  • Move authentication request to dedicated class

    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.

    question 
    opened by Kryniol 3
  • Inconsistent docblocks and return type declarations

    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.

    opened by krzysztof-ciszewski 3
  • Error invalid_grant when doing doRequest

    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?

    opened by Err0r404 2
  • Mysterious prefix

    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.

    opened by Kryniol 2
  • Invalid dependency in composer.json

    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.

    opened by Kryniol 1
  • Wrong parent class for NotFoundException

    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

    opened by Kryniol 1
  • Create value objects

    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.

    opened by Kryniol 1
  • Run CI builds on newer PHP versions

    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.

    opened by Kryniol 0
  • Remove code duplications reported by Scrutinizer

    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

    opened by adrianwaler 0
  • Scrutinizer - improve code coverage of ExpressionFactory

    Scrutinizer - improve code coverage of ExpressionFactory

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

    opened by Kryniol 0
  • Scrutinizer - duplicated method in QueryBuilder

    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

    opened by Kryniol 0
  • composer error trying to get the correct compatable versions

    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

    opened by inpresif 0
  • Update GitHub hooks for Packagist

    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.

    opened by Kryniol 0
  • Update URLs in the documentation

    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.

    opened by Kryniol 0
Releases(v1.0.3)
Owner
Boldare / XSolve Sp. z o.o.
Boldare / XSolve Sp. z o.o.
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

Twilio SendGrid 1.4k Dec 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

Twilio 1.4k Jan 2, 2023
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

IOTA Community 45 Dec 13, 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

Nexmo 75 Sep 23, 2022
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\

Thomas 3 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

Wid'op 24 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

Xendit 96 Jan 6, 2023
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

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

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

Артём Соколовский 2 Feb 6, 2022
This package help you build your REST API documentation.

Laravel API Doc This package help you build your REST API documentation. Installation You can install the package via composer: composer require axeld

Axel 2 May 19, 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

Robert Weiss 5 Aug 29, 2022
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

Sergey Bykov 63 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

Hugo Soares 0 Aug 11, 2022
Notifies via Telegram when an aircraft passes over a certain area.

adsbTelegramNotifier Notifies via Telegram when an aircraft passes over a certain area. The script gets the data from an existing readsb or dump1090 i

RundesBalli 6 Dec 18, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
Laravel Package for 1APP. Learn how to integrate our APIs to build a web or mobile integration to send and accept payments for your application and businesses.

1APP Laravel Library Learn how to integrate our APIs to build a web or mobile integration to accept payments, make payment of Bills and as well custom

O'Bounce Technologies 4 Jul 25, 2022
The Smart-ID PHP client can be used for easy integration of the Smart-ID solution to information systems or e-services

Smart-ID PHP client Introduction The Smart-ID PHP client can be used for easy integration of the Smart-ID solution to information systems or e-service

SK ID Solutions 16 Oct 23, 2022
Laravel ClickHouse adds CH client integration, generation & execution of ClickHouse database migrations to the Laravel application.

Laravel ClickHouse Introduction Laravel ClickHouse database integration. This package includes generation and execution of the ClickHouse database mig

cybercog 11 Dec 20, 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.

null 3 May 18, 2022