synergitech/laravel-salesforce
Composer 安装命令:
composer require synergitech/laravel-salesforce
包简介
This package uses omniphx/forrest to provide an Eloquent-style way of querying sObjects from Salesforce.
关键字:
README 文档
README
This package uses omniphx/forrest to provide an Eloquent-style way of querying sObjects from Salesforce.
⚠️ This is an initial version that only allows for the selecting of data. Newer versions will aim to provide a more complete experience.
Getting Started
Follow the instructions provided at omniphx/forrest to connect to your Salesforce environment.
Once done, you can then use the SynergiTech\Salesforce\Facades\Salesforce facade to perform queries against a particular table like so:
use SynergiTech\Salesforce\Facades\Salesforce; // Get an individual record by Id Salesforce::table('MyTable')->find('YourIdHere');
Available Methods
find
Allows you to directly pull an individual record as an array by Id. You can also specify another field name as the second parameter. If you specify a non-unique column and multiple records are returned then the first record is always returned.
Usage
Salesforce::table('MyTable')->find('YourIdHere');
findMany
Allows you to directly pull multiple records as a Laravel Collection by provide an array of their respective Id fields. You can also specify another field name as the second parameter.
Usage
Salesforce::table('MyTable')->findMany(['YourId1Here', 'YourId2Here']);
create
Allows you to create a new record on the specified table using an array of fields.
Usage
$response = Salesforce::table('MyTable')->create([ 'Name' => 'John Doe', ]);
Expected Response
[
'id' => '', // Salesforce Id
'success' => true,
'errors' => [],
'data' => [
// Full record data
],
]
update
Allows you to update a record using it's Salesforce Id with an array of fields.
Usage
$response = Salesforce::table('MyTable')->update('Id', [ 'Name' => 'John Doe', ]);
Expected Response
See 'create' above
createOrUpdate
Allows you to upsert a record using an Id field and the associated value.
Usage
$response = Salesforce::table('MyTable')->createOrUpdate('My_External_Id__c', 'ExternalId', [ 'Name' => 'John Doe', ]);
Expected Response
[
'id' => '', // Salesforce Id
'success' => true,
'errors' => [],
'created' => true, // True/False depending on whether the record was created or updated
'data' => [
// Full record data
],
]
delete
Allows you to delete a record by it's Id, returning true if successful.
Usage
Salesforce::table('MyTable')->delete('Id');
Query Builder
This package allows you to scope your get calls using query builder methods.
Query builders cannot currently be used in conjunction with the update or delete methods (sorry 🙏).
where
You can also scope your queries with where clauses.
// Basic where clause Salesforce::table('MyTable')->where('Name', 'John Doe')->get(); // You can also use any of the following operators // Equals and Not Equals Salesforce::table('MyTable')->where('Name', '=', 'John Doe')->get(); Salesforce::table('MyTable')->where('Name', '!=', 'John Doe')->get(); // Comparisons Salesforce::table('MyTable')->where('Age', '<', 30)->get(); Salesforce::table('MyTable')->where('Age', '<=', 30)->get(); Salesforce::table('MyTable')->where('Age', '>', 30)->get(); Salesforce::table('MyTable')->where('Age', '>=', 30)->get(); // Like Salesforce::table('MyTable')->where('Name', 'LIKE', 'John %')->get(); Salesforce::table('MyTable')->where('Name', 'LIKE', '% Middlename %')->get(); Salesforce::table('MyTable')->where('Name', 'LIKE', '% Doe')->get();
whereIn
You can provide an array of possible values to the whereIn method to select any records that match any of the values.
Salesforce::table('MyTable')->whereIn('Country', ['United Kingdom', 'United States'])->get();
orderBy
You can order by a particular field in either ascending or descending order.
// Ascending (default) Salesforce::table('MyTable')->orderBy('Age')->get(); // Descending Salesforce::table('MyTable')->orderBy('Age', 'DESC')->get();
nullsLast
By default when chaining an orderBy null values are returned first.
You can chain on ->nullsLast() to return null values last.
Salesforce::table('MyTable')->orderBy('LastLoginDate')->nullsLast()->get();
limit
You can limit the amount of records returned.
Salesforce::table('MyTable')->where('Name', 'LIKE', 'John%')->limit(20)->get();
Exceptions
By default omniphx/forrest typically throws a single exception with more detail contained within a JSON encoded string. We've wrapped some with our own exceptions to help with debugging.
synergitech/laravel-salesforce 适用场景与选型建议
synergitech/laravel-salesforce 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45.11k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「salesforce」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 synergitech/laravel-salesforce 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 synergitech/laravel-salesforce 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 synergitech/laravel-salesforce 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client for the Salesforce SOAP API
WakeOnWeb Salesforce client
FormRelay route for SFDC Web-To-Lead API.
WakeOnWeb Salesforce bundle
An ORM solution for Salesforce Object Query Language (SOQL)
Alfabank REST API integration
统计信息
- 总下载量: 45.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-09