Skip to main content

PHP

Learn how to install and configure our PHP SDK to use Efí APIs

PHP SDK for integrating with Efí APIs for Pix issuance, bank slips, installment payments, credit card payments, subscriptions, payment links, marketplace, Pix via Open Finance, payment of bank slips, among other functionalities.


Attention!

Requests made to Efí APIs using the PHP SDK require the certificate generated in your Efí account in .pem or .p12 format.


Prerequisites

The following prerequisites should be considered, according to the branch used:

Efí Pay SDK

Branch VersionStatusPackagistRepositoryPHP Version
1.xMaintainedefipay/sdk-php-apis-efimaster >= 7.2

Installation via Packagist with Composer

  composer require efipay/sdk-php-apis-efi

Installing the Latest Version via GitHub with Git

Our SDK is also available in our Github repository at Efí.

git clone https://github.com/efipay/sdk-php-apis-efi.git
cd sdk-php-apis-efi/
composer install

After installation, dependency download will happen automatically. These dependencies will be stored in their respective folders, and Composer will continue its work by generating the composer.lock file.

It's worth noting that if you need to, for example, exclude a package, simply delete its reference from the composer.json file and update Composer using the following command:

$ composer update

This way, Composer will be updated, and since the package is no longer present in the require directive, it will be immediately "uninstalled."


Summary

  • Install Composer;
  • Specify the Efí SDK to be installed in the composer.json file;
  • Run the installation command in the project directory: composer install;
  • That's it!

Running Examples

You can run them using any web server, such as Apache or nginx, and open any example in your browser.

Information

Some examples require you to change certain parameters to work, such as /examples/pix/cob/pixCreateCharge.php or /examples/charges/billet/createOneStepBillet.php.


Migration Validator

If you already have integration with Gerencianet's PHP SDK and are looking to prepare your application for future Efí API innovations, you can use our validator to assist in migrating to this SDK.

The Efí SDK Migration Validator makes the migration process smoother and more efficient. This tool does not modify your code; it only analyzes existing code for specific patterns related to classes and methods that have been changed in the new version of the SDK.

Before making any changes to your application code, it is highly advisable to make a complete backup of your entire project.

For more details on how to use it, refer to our Github repository.


Common Errors (cURL error 60 or cURL error 77)

The following errors are not from the Efí API but related to components of your server. Check below for the most common errors during the installation of our API and see the solutions:


Extra: timeout option

This attribute is present in the PHP SDK and allows you to set how long you want the Guzzle request to wait for a response. For details on how to use it, refer to our Github repository.