{"id":39440086,"url":"https://github.com/sendynl/php-sdk","last_synced_at":"2026-01-18T04:18:55.077Z","repository":{"id":153479591,"uuid":"613242483","full_name":"sendynl/php-sdk","owner":"sendynl","description":"PHP library to connect with the Sendy API","archived":false,"fork":false,"pushed_at":"2025-11-04T14:39:00.000Z","size":115,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-05T00:44:30.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/sendynl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-13T07:31:44.000Z","updated_at":"2025-11-04T14:36:39.000Z","dependencies_parsed_at":"2025-05-15T15:34:20.642Z","dependency_job_id":"438b0db3-e987-432b-aa8c-8ab40a690ce7","html_url":"https://github.com/sendynl/php-sdk","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sendynl/php-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendynl%2Fphp-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendynl%2Fphp-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendynl%2Fphp-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendynl%2Fphp-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sendynl","download_url":"https://codeload.github.com/sendynl/php-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sendynl%2Fphp-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":"2026-01-18T04:18:55.019Z","updated_at":"2026-01-18T04:18:55.068Z","avatar_url":"https://github.com/sendynl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sendy API PHP Client\n\nPHP Client library to connect with the Sendy API. This client lets you connect with the Sendy API to create shipments\nand labels.\n\n[![Code quality](https://github.com/keendelivery/php-sdk/actions/workflows/code_quality.yml/badge.svg)](https://github.com/keendelivery/php-sdk/actions/workflows/code_quality.yml) [![Tests](https://github.com/keendelivery/php-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/keendelivery/php-sdk/actions/workflows/tests.yml)\n\n## Installation\nInstalling the client can be done through Composer:\n```\ncomposer require sendynl/php-sdk\n```\n\n## Usage\n\n### Authentication\n\nAuthentication can be done in two different ways: with personal access tokens and the OAuth flow. \n\n#### Personal Access Tokens\n\nYou can manage your personal access tokens in [the portal](https://app.sendy.nl/settings/personal-access-tokens). When\nyou have a personal access token, you can use this library like this:\n\n```php\n\u003c?php\n\n$connection = new \\Sendy\\Api\\Connection();\n\n$connection-\u003esetAccessToken('your-personal-access-token');\n\n$connection-\u003eme-\u003eget();\n```\n\n#### OAuth\n\n##### Authorize the connection from your app\n\n```php\n$connection = new \\Sendy\\Api\\Connection();\n\n$connection-\u003esetOauthClient(true);\n\n$connection-\u003esetClientId('your-client-id')\n    -\u003esetClientSecret('your-client-secret')\n    -\u003esetRedirectUrl('your-callback-url');\n\n$connection-\u003eredirectForAuthorization();\n```\n\nThis will redirect the user to the portal and authorize your integration with their account.\n\n##### Connect with the API\n\n```php\n$connection = new \\Sendy\\Api\\Connection();\n\n$connection-\u003esetClientId('your-client-id')\n    -\u003esetClientSecret('your-client-secret')\n    -\u003esetRedirectUrl('your-callback-url');\n\n// Either an authorization code or a refresh token is required to fetch an access token\n$connection-\u003esetAuthorizationCode('authorization-code');\n$connection-\u003esetRefreshToken('refresh-token');\n\n// Optional if you have alreay stored the access token in your application\n$connection-\u003esetAccessToken('access-token');\n$connection-\u003esetTokenExpires(1123581321);\n\n$connection-\u003eme-\u003eget();\n\n// Store the access token, refresh token en the expiration timestamp in your application to prevent unnecessary\n// requesting new access tokens\n$connection-\u003egetAccessToken();\n$connection-\u003egetRefreshToken();\n$connection-\u003egetTokenExpires();\n```\n\n##### Token refresh callback\nIt is possible to provide the connection a `callable` to execute when the tokens are refresh. This can be useful when \nyou want to store the new tokens in your application to reuse them when necessary.\n\n```php\n$connection = new \\Sendy\\Api\\Connection();\n\n$connection-\u003esetOauthClient(true);\n\n$connection-\u003esetClientId('your-client-id')\n    -\u003esetClientSecret('your-client-secret')\n    -\u003esetRedirectUrl('your-callback-url')\n    -\u003esetTokenUpdateCallback(function (\\Sendy\\Api\\Connection $connection) {\n        $data = [\n            'access_token' =\u003e $connection-\u003egetAccessToken(),\n            'refresh_token' =\u003e $connection-\u003egetRefreshToken(),\n            'token_expires' =\u003e $connection-\u003egetTokenExpires(),\n        ];\n        \n        // Use this data to store the tokens in your application\n    });\n```\n\n### Transports\n\nThe Sendy PHP SDK uses a concept called \"transports\" to send the HTTP requests to the Sendy API. By default, the [`TransportFactory`](https://github.com/sendynl/php-sdk/blob/main/src/Http/Transport/TransportFactory.php) will pick a suitable Transport for the environment if you do not supply one.\n\nIf, for example, your application already has a specific HTTP client library available, you may want to provide your own transport implementation. To create your own transport, create a class that implements `Sendy\\Api\\Http\\Transport\\TransportInterface`.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAn example for the Laravel framework could look like this (click to expand)\u003c/summary\u003e\n\n```php\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\Facades\\Http;\nuse Sendy\\Api\\Exceptions\\TransportException;\nuse Sendy\\Api\\Http\\Request;\nuse Sendy\\Api\\Http\\Response;\nuse Sendy\\Api\\Http\\Transport\\TransportInterface\n\nclass LaravelTransport implements TransportInterface\n{\n    public function send(Request $request): Response\n    {\n        $headers = $request-\u003egetHeaders();\n        $contentType = Arr::pull($headers, 'Content-Type', 'application/json');\n\n        try {\n            $response = Http::withHeaders($headers)\n                -\u003ewithBody($request-\u003egetBody(), $contentType)\n                -\u003ewithMethod($request-\u003egetMethod())\n                -\u003ewithUrl($request-\u003egetUrl())\n                -\u003esend();\n        } catch (\\Throwable $e) {\n            throw new TransportException($e-\u003egetMessage(), $e-\u003egetCode(), $e);\n        }\n\n        return new Response($response-\u003estatus(), $response-\u003eheaders(), $response-\u003ebody());\n    }\n\n    public function getUserAgent() : string\n    {\n        return 'LaravelHttpClient/' . Application::VERSION;\n    }\n}\n```\n\n\u003c/details\u003e\n\nTo use your transport, set it on the connection:\n\n```php\n$connection = new \\Sendy\\Api\\Connection();\n\n$connection-\u003esetTransport(new LaravelTransport());\n```\n\n### Endpoints\n\nThe endpoints in the API documentation are mapped to the resource as defined in the Resources directory. Please consult\nthe [API documentation](https://app.sendy.nl/api/docs) for detailed documentation. \n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you've found a bug regarding security please mail security@sendy.nl instead of using the issue tracker.\n\n## License\n\nThe MIT License (MIT). Please see the [License file](LICENSE) for more information\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendynl%2Fphp-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsendynl%2Fphp-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsendynl%2Fphp-sdk/lists"}