blackbricksoftware / laravel-migration-builder-salesforce
Create migration of object structure from Salesforce Org to a local database.
Requires
- php: ^8.0.2
- blackbricksoftware/laravel-migration-builder: ^0.3
- illuminate/console: ^9.2
- illuminate/support: ^9.2
- omniphx/forrest: ^2.11
README
Description
Create migration as analogs to Salesforce objects read from a connected org. Useful for staging data for import or downloading data for warehousing.
See Laravel Migration Builder as well.
Installation
Install package
composer require blackbricksoftware/laravel-migration-builder-salesforce --dev
Publish configuration
php artisan vendor:publish --tag=laravel-migration-builder-salesforce-config
Modify .env
Add the following lines. See the Salesforce REST API Client for Laravel page for specific configuration details.
SF_AUTH_METHOD=UserPassword
SF_CONSUMER_KEY=123455
SF_CONSUMER_SECRET=ABCDEF
SF_CALLBACK_URI=https://test.app/callback
SF_LOGIN_URL=https://login.salesforce.com
#SF_LOGIN_URL=https://test.salesforce.com
SF_USERNAME=test@example.com
SF_PASSWORD=password123
SF_AUTH_METHOD=UserPassword
will likely be the easiest method for a CLI application.
SF_LOGIN_URL
will generally be https://login.salesforce.com
for a live org or https://test.salesforce.com
for a sandbox org.
SF_PASSWORD
will be the user's login password with the user's token concatenated on the end.
Modify configuration (optional)
Change storage.type
to object
if you intend to use more than one Salesforce connection.
Usage
Commands
php artisan make:migration-builder:salesforce:object ObjectName
: make a migration mirroring the structure of the given object (ObjectName
)php artisan make:migration-builder:salesforce:object:list
: list available object in connected Salesforce Orgphp artisan make:migration-builder:salesforce:object:debug ObjectName
: create a 3 files in the (aObjectName.var_dump.txt
,Objectname.print_r.txt
, and pretty printedObjectName.json
) in theStorage::disk('local')
directory (usuallystorage/app/migration-builder/salesforce/
) showing the response from the Salesforce REST API.
Acknowledgement
- omniphx for the Salesforce REST API Client for Laravel
- This Salesforce Developer document I guess.