Download the PHP package myoutdeskllc/salesforce-php without Composer
On this page you can find all versions of the php package myoutdeskllc/salesforce-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download myoutdeskllc/salesforce-php
More information about myoutdeskllc/salesforce-php
Files in myoutdeskllc/salesforce-php
Package salesforce-php
Short Description salesforce library for php8+
License MIT
Informations about the package salesforce-php
Salesforce PHP API
A beautiful, extendable API powered by Saloon.
Introduction
This API provides a feature rich, elegant baseline for working with the Salesforce API. Developers can install and leverage this API to help them integrate Salesforce easily and beautifully. These endpoints return salesforce responses, and most of the endpoints contain links to specific documentation.
Installation
composer require myoutdeskllc/salesforce-php
Features
There are many out of the box features ready for you to build upon.
- Authentication
- OAuth
- Username \ Password Flow (API Users)
- Basic Operations
- Query record(s)
- Insert record(s)
- Supports decorated methods for popular common objects
- Leads
- Accounts
- Opportunities
- Contacts
- Search Helpers
- SObject Metadata API
- Query basic information
- Query full metadata (fields, etc)
- Bulk API 2.0
- Create and manage bulk api 2.0 jobs
- Several upload methods supported
- CSV via filename
- CSV via file stream
- Pass in records as an array
- Includes SalesforceJob class to help manage operations
- This is optional and direct methods are also exposed
- Run SOQL Queries
- Access SOQL Query Builder
- Helper functions for SOQL date constants
- Analytics API (Reports, Dashboards)
- List, Query Basic Information, Metadata for Reports, Dashboards
- List, Create, Update, Delete, Search for report and dashboard folders
- Create, Manage, Update, Delete, Copy Reports
- Create, Manage, Update, Delete, Copy Dashboards
- Run Dashboards, Reports & Get Results Synch, Asynch
- Tooling API
- Get information on apex classes, apex pages
- List, Download Apex Logs
- List previous runs, run tests over REST (sync, async)
- Execute anonymous apex
- List, Get, Delete Email Templates
- Creating email templates is horrific. You can, but don't bother.
- Organization
- Supported API versions
- Limits
Authentication
Two authentication methods are supported. OAuth and Username \ Password. OAuth is the preferred method unless you are using server to server integrations.
OAuth
OAuth is the preferred method of authentication. First, you will need to create an application in your Salesforce instance, then copy the redirect_uri, client id, and client secret to get started.
Password Authentication
Please visit YOUR_DOMAIN.com/_ui/system/security/ResetApiTokenEdit
to get a security token reset. It will email the user. This must be
appended to the back of the password when authenticating with the password flow unless you are using a whitelisted IP address range.
Record Level Operations
There are several methods available to execute CRUD operations on records in salesforce.
Create Records
You may either use CreateRecord or CreateRecords to insert records into Salesforce.
When creating multiple records, you may pass in a third boolean for allOrNone to determine if they should all succeed for the operation to be committed in salesforce.
Read Records
The API provides a few different ways to query records. The most common way is to use the getRecord
method.
You may also queryRecords
to get several records at once.
Update Records
You may update records using the updateRecord
method.
Delete Records
You may delete records using the deleteRecord
method.
allOrNone is supported for delete operations as a second parameter.
When updating multiple records, you may pass in a third boolean for allOrNone to determine if they should all succeed for the operation to be committed in salesforce.
Searching For Records
The API provides a few different ways to search for records.
Searching within specific Objects
Searching within specific objects, within a specific field
Searching across all objects:
Salesforce Native Objects
The API provides a few helper methods to get common objects.
You can see a full list of operations available in the StandardObjectApi
Batch Jobs
Batch job support for records is available via a job wrapper, completed with CSV support.
Soql Builder
The SOQL builder can help build out queries in your app more effectively. You'll want to make sure security is tight before it hits the builder, but it offers a fluent API to help build out queries.
output:
> SELECT Id, Name, created_at FROM Account WHERE Name = 'Test' ORDER BY created_at DESC LIMIT 20
Testing
Testing is done via PestPHP. To ensure full coverage of Salesforce features a scratch org was set up to test this against a live sandbox API. While this means expanding tests is going to be more work, it also means it's battle tested against real data.
Get a copy of the scratch org definition
Copy .env.example to .env, update the redirect_url to be your local machine URL. Set the base_url to https://test.salesforce.com
.
Scratch Org Setup
- Signup for a developer edition organization here
- Login and head to the Dev Hub
/lightning/setup/DevHub/home
and turn the slider toenabled
- Install the Salesforce DX CLI
- Pull the salesforce-php-dx project
- In terminal, type
sfdx force:auth:web:login --setdefaultdevhubusername
and login to the developer hub - Create a scratch org
sfdx force:org:create -f config/project-scratch-def.json --setalias salesforcephpdx --durationdays 7 --setdefaultusername --json --loglevel fatal
- Use
sfdx force:org:open
to open your scratch organization - Execute the apex in
scripts/apex/seed.apex
in dev console (or use VSCODE)
Contributors
All versions of salesforce-php with dependencies
sammyjo20/saloon Version ^2.0
league/csv Version ^9.8
mihasicehcek/php_salesforce_soql_builder Version ^1.0