{"id":20140260,"url":"https://github.com/10quality/salsa-api-php","last_synced_at":"2026-05-08T12:44:20.921Z","repository":{"id":56937935,"uuid":"86766841","full_name":"10quality/salsa-api-php","owner":"10quality","description":"Package that facilitates the usage of Salsa API on PHP.","archived":false,"fork":false,"pushed_at":"2017-05-26T18:10:01.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v1.0","last_synced_at":"2025-05-15T16:56:11.854Z","etag":null,"topics":[],"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/10quality.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-31T01:52:13.000Z","updated_at":"2017-03-31T05:03:23.000Z","dependencies_parsed_at":"2022-08-21T06:50:10.881Z","dependency_job_id":null,"html_url":"https://github.com/10quality/salsa-api-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/10quality/salsa-api-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fsalsa-api-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fsalsa-api-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fsalsa-api-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fsalsa-api-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/10quality","download_url":"https://codeload.github.com/10quality/salsa-api-php/tar.gz/refs/heads/v1.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fsalsa-api-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080738,"owners_count":27282294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-26T02:00:06.075Z","response_time":193,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-13T21:49:55.400Z","updated_at":"2025-11-27T13:02:11.231Z","avatar_url":"https://github.com/10quality.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Salsa API (PHP)\n\n[![Latest Stable Version](https://poser.pugx.org/10quality/salsa-api-php/v/stable)](https://packagist.org/packages/10quality/salsa-api-php)\n[![Total Downloads](https://poser.pugx.org/10quality/salsa-api-php/downloads)](https://packagist.org/packages/10quality/salsa-api-php)\n[![License](https://poser.pugx.org/10quality/salsa-api-php/license)](https://packagist.org/packages/10quality/salsa-api-php)\n\n[Salsa](https://help.salsalabs.com/hc/en-us) API wrapper/handler for PHP.\n\n## Scope\n\nCurrent supporting end-points:\n* Metrics\n* Supporters\n\n## Installation\n\nWith composer, make the dependecy required in your project:\n```bash\ncomposer require 10quality/salsa-api-php\n```\n\n## Usage\n\nInitialize the API instance:\n```php\nuse Salsa\\Api;\n\n$api = Api::instance([\n    'token'     =\u003e '..YOUR-ACCESS-TOKEN..',\n    'env'       =\u003e 'live', // For development change to 'sandbox'\n    'sandbox'   =\u003e 'https://sandbox.salsalabs.com/' // Sandbox environment custom base URL.\n]);\n```\n\n### Metrics endpoint\n\nNext shows how to get metrics from Salsa:\n```php\nuse Salsa\\Metrics;\n\n$endpoint = new Metrics($api);\n\n// Retrieve metrics response\n$response = $endpoint-\u003eget();\n\n// A specific metric\necho $endpoint-\u003eget()-\u003epayload-\u003etotalAPICalls;\n```\n\n### Supporters endpoint\n\nNext sample shows how to search for supporters:\n```php\nuse Salsa\\Supporters;\n\n$endpoint = new Supporters($api);\n\n// Search for supporters\n$response = $endpoint-\u003esearchByEmail('an-email@domain.com');\n$response = $endpoint-\u003esearchByEmails(['an-email@domain.com', 'second-email@domain.com']);\n\n// Retrieve supporters from response\nprint_r($response-\u003esupporters);\n```\n\nNext sample shows how to create/update a new supporter:\n```php\nuse Salsa\\Supporters;\nuse Salsa\\Models\\Supporter;\n\n// Define the endpoint\n$endpoint = new Supporters($api);\n\n// Create supporter using model\n$supporter = new Supporter;\n$supporter-\u003eemail = 'an-email@domain.com';\n$supporter-\u003etitle = 'Mr';\n$supporter-\u003efirstName = 'Alejandro';\n$supporter-\u003elastName = 'Mostajo';\n$supporter-\u003eaddress = [\n    'line1' =\u003e 'Alice in wonderland',\n    'line2' =\u003e 'In the books',\n    'city'  =\u003e 'San Diego',\n    'state' =\u003e 'CA',\n    'postalCode' =\u003e '99999',\n    'county' =\u003e 'CA',\n    'country' =\u003e 'US',\n];\n$supporter-\u003edateOfBirth = '2017-01-01';\n// Phones\n$supporter-\u003ecellphone = '1234567890';\n$supporter-\u003eworkphone = '1234567890';\n$supporter-\u003ehomephone = '1234567890';\n// Custom fields\n$supporter-\u003eaddCustomField(\n    null, // Field ID\n    'Nickname', // Field Name\n    'Piru', // Value\n    null // Type\n);\n\n// Add supporter\n$response = $endpoint-\u003eupdate($supporter);\n\n// Get updated supporters with their Salsa Supporter ID\n$response-\u003esupporters;\n\n// Add multiple supporters\n$response = $endpoint-\u003eupdateBatch([$supporter, $supporter2]);\n```\n\n**NOTE:** Supporter models must include property `supporterId` in order to be updated.\n\n**NOTE:** Custom fields types: STRING, NUMBER, DATE, TIMESTAMP, BOOL.\n\nNext sample shows how to delete an existint supporter:\n```php\nuse Salsa\\Supporters;\nuse Salsa\\Models\\Supporter;\n\n// Define the endpoint\n$endpoint = new Supporters($api);\n\n// Create supporter using model\n$supporter = new Supporter;\n$supporter-\u003esupporterId = '-an-id-';\n\n// Delete supporter\n$response = $endpoint-\u003edelete($supporter);\n\n// Delete multiple supporters\n$response = $endpoint-\u003edeleteBatch([$supporter, $supporter2]);\n```\n\n## Coding guidelines\n\nPSR-4.\n\n## LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 [10Quality](http://www.10quality.com).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10quality%2Fsalsa-api-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F10quality%2Fsalsa-api-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10quality%2Fsalsa-api-php/lists"}