Download the PHP package frankkessler/salesforce-laravel-oauth2-rest without Composer
On this page you can find all versions of the php package frankkessler/salesforce-laravel-oauth2-rest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download frankkessler/salesforce-laravel-oauth2-rest
More information about frankkessler/salesforce-laravel-oauth2-rest
Files in frankkessler/salesforce-laravel-oauth2-rest
Package salesforce-laravel-oauth2-rest
Short Description A Salesforce REST api wrapper utilizing oAuth2
License MIT
Informations about the package salesforce-laravel-oauth2-rest
RUNNING UNIT TESTS
There are currently two ways to run the unit tests. Keep in mind that node is a dependency for running the unit tests regardless of which way you want to run them.
If you have make installed you can run
If you would prefer to see more details about how the unit tests run, you can start the node server and then run the unit tests from another window.
Then in a different window:
INSTALLATION
To install this package, add the following to your composer.json file
LARAVEL 5 SPECIFIC INSTALLATION TASKS
Add the following to your config/app.php file in the providers array
Add the following to your config/app.php file in the aliases array
Run the following command to pull the project config file and database migration into your project
Run the migration
OPTIONAL INSTALLATION
Logging is enabled by default if using Laravel. If not, add the following to the $config parameter when initializing the Salesforce class. (This class must implement the Psr\Log\LoggerInterface interface.)
TOKEN SETUP
Currently, this package only supports the web server flow (Authorization Code) and JWT Web Tokens for oauth2.
Web Server Flow Setup (Authorization Code)
This utilizes access and refresh tokens in order to grant access.
To get started, you'll have to setup a Connected App in Salesforce.
- Navigate to Setup -> Create -> Apps
- In the Connected Apps section, click New
- Fill out the form including the Api/Oauth section.
- Your callback URL must be https and will follow this format: http://yourdomain.com/salesforce/callback
- Save and wait 10 minutes for the settings to save.
Now that you have your Client Id and Client secret, add them to your .env file:
To login and authorize this application add the following to your routes.php file. You may remove these routes once you have your refresh token stored in the database.
Visit https://yourdomain.com/salesforce/login to authorize your application. Your access token and refresh token will be stored in the salesforce_tokens database table by default.
JWT Web Token
Setup your public and private key pair. Salesforce recommends you use an RSA 256 key. Here is a sample script that will generate a key for you in PHP.
Setup your app in Salesforce:
- Navigate to Setup -> Create -> Apps
- In the Connected Apps section, click New
- Fill out the form including the Api/Oauth section.
- Your callback URL must be https and will follow this format: http://yourdomain.com/salesforce/callback
- Check off "Use Digital Signature" and upload the PUBLIC key (public.crt) generated in the previous section.
- Select the Oauth scopes you want, but make sure you select the refresh_token, offline_access scope or this flow will fail.
- Save
- To get up and running as quick as possible you can follow the next few steps, but they might not work for everyone.
- Navigate to Setup -> Manage Apps -> Connected Apps and click on the App you just created
- Click edit and select "Admin approved users are pre-authorized" in the Permitted users field
- Click Save
- Scroll down on the same page and select the Manage Profiles button to add the profiles that are pre-authorized to use JWT Web Tokens in your app
Add the following variables to your .env file.
EXAMPLES
Get a sObject record
Insert a sObject record
Update a sObject record
Delete a sObject record
Perform a SOQL Query
Perform a SOQL Query that will get all the records
Perform a SOSL Query
Bulk Api Processing
Insert
Upsert
Query
Query with PK Chunking
Query with Class to Process each Batch
Custom REST Endpoint (GET)
Custom REST Endpoint (POST)
All versions of salesforce-laravel-oauth2-rest with dependencies
guzzlehttp/guzzle Version ~6.0
frankkessler/guzzle-oauth2-middleware Version 0.1.*
illuminate/http Version ~5.1
illuminate/routing Version ~5.1
illuminate/support Version ~5.1
illuminate/database Version ~5.1
psr/log Version ~1.0