{"id":42460081,"url":"https://github.com/eventfarm/restforcephp","last_synced_at":"2026-01-28T09:16:44.240Z","repository":{"id":37547454,"uuid":"69632913","full_name":"eventfarm/restforcephp","owner":"eventfarm","description":"PHP Client for the Salesforce REST API","archived":false,"fork":false,"pushed_at":"2024-01-03T06:17:15.000Z","size":184,"stargazers_count":21,"open_issues_count":7,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-25T07:38:07.362Z","etag":null,"topics":["php","php-client","rest-api","rest-client","salesforce","salesforce-api"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eventfarm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-30T04:11:04.000Z","updated_at":"2024-11-23T01:53:26.000Z","dependencies_parsed_at":"2022-08-18T03:01:41.860Z","dependency_job_id":"ac5c8a3c-6c00-4a61-9d30-5e6bf3d3d3f8","html_url":"https://github.com/eventfarm/restforcephp","commit_stats":{"total_commits":153,"total_committers":7,"mean_commits":"21.857142857142858","dds":"0.12418300653594772","last_synced_commit":"b820847090c88aa8f1538fc2638b6a98715f05ac"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/eventfarm/restforcephp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventfarm%2Frestforcephp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventfarm%2Frestforcephp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventfarm%2Frestforcephp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventfarm%2Frestforcephp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eventfarm","download_url":"https://codeload.github.com/eventfarm/restforcephp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eventfarm%2Frestforcephp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28843393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T07:39:25.367Z","status":"ssl_error","status_checked_at":"2026-01-28T07:39:24.487Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php-client","rest-api","rest-client","salesforce","salesforce-api"],"created_at":"2026-01-28T09:16:43.589Z","updated_at":"2026-01-28T09:16:44.228Z","avatar_url":"https://github.com/eventfarm.png","language":"PHP","readme":"# Restforce PHP\n\n[![Travis](https://img.shields.io/travis/eventfarm/restforcephp.svg?maxAge=2592000?style=flat-square)](https://travis-ci.org/eventfarm/restforcephp)\n[![Downloads](https://img.shields.io/packagist/dt/eventfarm/restforcephp.svg?style=flat-square)](https://packagist.org/packages/eventfarm/restforcephp)\n[![Packagist](https://img.shields.io/packagist/l/eventfarm/restforcephp.svg?maxAge=2592000?style=flat-square)](https://packagist.org/packages/eventfarm/restforcephp)\n\nThis is meant to emulate what the [ejhomes/restforce gem](https://github.com/ejholmes/restforce) is doing for rails.\n\n## Installation\n\nThis library requires PHP 7.1 or later; we recommend using the latest available version of PHP.  It has been test through the latest version of PHP (v8.3 as of this writing)\n\n```\n$ composer require eventfarm/restforcephp\n```\n\nOr.\n\nAdd the following lines to your ``composer.json`` file.\n\n```json\n{\n    \"require\": {\n        \"eventfarm/restforcephp\": \"^2.0.0\"\n    }\n}\n```\n\n```bash\n$ composer install\n```\n\n## Project Defaults\n\n```php\n\u003c?php\nnamespace App;\n\nuse EventFarm\\Restforce\\Rest\\OAuthAccessToken;\nuse EventFarm\\Restforce\\Restforce;\nuse EventFarm\\Restforce\\RestforceInterface;\n\nclass DemoSalesforceApi\n{\n    /** @var null|RestforceInterface $restforce */\n    private $restforce;\n\n    public function getRestforceClient(): RestforceInterface\n    {\n        if ($this-\u003erestforce === null) {\n            // You need either the OAuthAccessToken\n            // or the Username \u0026 Password,\n            // the other(s) can be null.\n            $this-\u003erestforce = new Restforce(\n                getenv('SF_CLIENT_ID'),\n                getenv('SF_CLIENT_SECRET'),\n                new OAuthAccessToken(...),\n                getenv('SF_USERNAME'),\n                getenv('SF_PASSWORD')\n            );\n        }\n        return $this-\u003erestforce;\n    }\n}\n```\n\n## Access Token Information\n\n#### OAuth Scopes\n\nConsult the [Salesforce OAuth 2.0 Documentation](https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Configuring_OAuth_2.0_Access_for_your_Application) to find out what Available OAuth Scopes your app needs.\n\n## Salesforce Documentation\n\nLinks to Salesforce documentation pages can be found in each section. Alternatively, here is the [holy grail of the Saleforce endpoints.](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_list.htm)\n\n## Usage\n\n#### Limits\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm?search_text=limits) Returns a list of daily API limits for the salesforce api. Refer to the docs for the full list of options.\n\n`public function limits(): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003elimits();\n```\n\n\n#### UserInfo\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/oauth_using_identity_urls.htm) Get info about the logged-in user.\n\n`public function limits(): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003euserInfo();\n```\n\n#### Query\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm) Use the Query resource to execute a SOQL query that returns all the results in a single response.\n\n`public function query(string $query): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003equery('SELECT Id, Name FROM Account');\n```\n\n#### Find\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm?search_text=limits) Find resource `$id` of `$sobject`, optionally specify the fields you want to retrieve in the fields parameter and use the GET method of the resource.\n\n`public function find(string $sobject, string $id, array $fields = []): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface= $restforce-\u003efind('Account', '001410000056Kf0AAE');\n```\n\n#### Describe\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_describe.htm?search_text=describe) Completely describes the individual metadata at all levels for the specified object.\n\n`public function describe(string $sobject): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003edescribe('Account');\n```\n\n#### Create\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) Create new records of `$sobject`. The response body will contain the ID of the created record if the call is successful.\n\n`public function create(string $sobject, array $data): \\Psr\\Http\\Message\\ResponseInterface`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003ecreate('Account', [\n    'Name' =\u003e 'Foo Bar'\n]);\n```\n\n#### Update\n\n[Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm?search_text=describe) You use the SObject Rows resource to update records. The response will be the a bool of `$success`.\n\n`public function update(string $sobject, string $id, array $data):bool`\n\n```php\n\u003c?php\n/** @var \\EventFarm\\Restforce\\RestforceInterface $restforce */\n$restforce = (new DemoSalesforceApi())-\u003egetClient();\n/** @var \\Psr\\Http\\Message\\ResponseInterface $responseInterface */\n$responseInterface = $restforce-\u003eupdate('Account', '001i000001ysdBGAAY', [\n    'Name' =\u003e 'Foo Bar Two'\n]);\n```\n\n## Contributing\n\nThanks for considering contributing to our Restforcephp project. Just a few things:\n\n- Make sure your commit conforms to the PSR-2 coding standard.\n- Make sure your commit messages are well defined.\n- Make sure you have added the necessary unit tests for your changes.\n- Run _all_ the tests to assure nothing else was accidentally broken.\n- Submit a pull request.\n\n#### Unit Tests:\n\n```bash\n$ vendor/bin/phpunit\n```\n\n##### With Code Coverage:\n\n```bash\n$ vendor/bin/phpunit --coverage-text --coverage-html coverage_report\n```\n\n#### Check PHP-CS PSR2 Test:\n\n```bash\n$ vendor/bin/phpcs -p --standard=PSR2 src/ tests/\n```\n\n#### Apply PHP-CS PSR2 Fix:\n\nAuto runs and resolves some low hanging PSR2 fixes, this might not get all of them, so rerun the check after.\n\n```bash\n$ vendor/bin/phpcbf --standard=PSR2 src/ tests/\n```\n\n#### Check Compatability for PHP Version:\n\n```bash\n$ vendor/bin/phpcs -p ./src/ --standard=PHPCompatibility --runtime-set testVersion 7.1-8.4\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventfarm%2Frestforcephp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feventfarm%2Frestforcephp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feventfarm%2Frestforcephp/lists"}