PHPackages                             payroc/payroc-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. payroc/payroc-sdk-php

ActiveLibrary[API Development](/categories/api)

payroc/payroc-sdk-php
=====================

Payroc PHP Library

0.0.3816(3w ago)10PHPPHP ^8.1

Since Feb 18Pushed yesterday2 watchersCompare

[ Source](https://github.com/payroc/payroc-sdk-php)[ Packagist](https://packagist.org/packages/payroc/payroc-sdk-php)[ RSS](/packages/payroc-payroc-sdk-php/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (6)Used By (0)

Payroc API PHP SDK
==================

[](#payroc-api-php-sdk)

[![php shield](https://camo.githubusercontent.com/c6935ea725f448fdb79c5a9a86bf2f898610c8bf44028a3192176889b47cdba6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d7061636b61676973742d70696e6b)](https://packagist.org/packages/payroc/payroc-sdk-php)

The Payroc API PHP SDK provides convenient access to the Payroc API from PHP.

Contents
--------

[](#contents)

- [Payroc API PHP SDK](#payroc-api-php-sdk)
    - [Requirements](#requirements)
    - [Installation](#installation)
    - [Usage](#usage)
        - [API Key](#api-key)
        - [PayrocClient](#payrocclient)
            - [Advanced Usage with Custom Environment](#advanced-usage-with-custom-environment)
    - [Exception Handling](#exception-handling)
    - [Logging](#logging)
    - [Pagination](#pagination)
        - [Pagination Gotcha](#pagination-gotcha)
    - [Polymorphic Types](#polymorphic-types)
        - [Creating Polymorphic Data](#creating-polymorphic-data)
        - [Handling Polymorphic Data](#handling-polymorphic-data)
    - [Advanced](#advanced)
        - [Custom Client](#custom-client)
        - [Retries](#retries)
        - [Timeouts](#timeouts)
    - [Contributing](#contributing)
    - [References](#references)

Requirements
------------

[](#requirements)

This SDK requires PHP ^8.1.

Installation
------------

[](#installation)

```
composer require payroc/payroc
```

Usage
-----

[](#usage)

### API Key

[](#api-key)

You need to provide your API Key to the `PayrocClient` constructor. In this example we read it from an environment variable named `PAYROC_API_KEY`. In your own code you should consider security and compliance best practices, likely retrieving this value from a secure vault on demand.

### PayrocClient

[](#payrocclient)

Instantiate and use the client with the following:

```
