Getting started
The main idea of the library is to simplify integration into your PHP application, and provide convenient methods for working with data coming the Apirone API. It also solves the problems of sending API requests, handling errors and exceptions, logging, working with the database, and actually displaying the invoice on your pages. All this has already been implemented in the SDK and works out of the box.
Despite the small size this library is a powerful SDK for integrating Apirone Invoices into your PHP application. The SDK simplifies work with requests to API and allows you to work with Invoice as a PHP class.
The library does not use dependencies from external developers. Only two dependencies are used here, also developed by Apirone. This gives us extra control over the library, makes sure that nothing will break due to external dependencies, and ensures that the library is small.
Requirements
- PHP 7.4 or higher. Tested up to 8.4.
- cURL extension
- JSON extension
Installation
Use composer for library installation.
composer require apirone/apirone-sdk-php
You can also download or clone the library from our github repository.
File structure
Let's take a look at the structure of the library and highlight the main files and folders you will have to work with when using the library.
src/
├─ assets/
│ └─ ...
├─ Model/
│ ├─ Settings/
│ | └─ Currency.php
│ ├─ Settings.php
│ ├─ UserData.php
│ └─ ...
├─ Service/
| ├─ tpl/
| | └─ ...
| ├─ InvoiceDb.php
| ├─ Render.php
| ├─ Utils.php
| └─ ...
└─ Invoice.php
- assets - Contains JS, CSS and image files for displaying the Invoice.
- Model - Contains classes for working with various data.
- Settings/Currency.php - Contains all currency properties and methods.
- Settings.php - Used to handle accounts, currencies, destinations, tariffs, synchronization and storage of settings.
- UserData.php - Used to configure some additional information about the Invoice (includes following fields: title, merchant, URL, price, sub-price, items, extras, etc.)
- Service - Contains service classes and invoice templates.
- tpl - Templates & locales.
- InvoiceDb.php - Work with your Database.
- Render.php - Display the Invoice.
- Utils.php - Contain some useful methods.
- Invoice.php - The main entry point to the library.
NOTE
All other classes of the library are not used directly, but will be described in the next sections of the documentation.
What's Next?
To find out what the Apirone Payment Gateway is, you can go to the official website or go to the API documentation.
To understand how to integrate the library into your project, read this short five-steps guide.
To learn more about what properties and methods are available in the library's classes, go to Dive Deeper.
To learn about real-world usage of the library or to see a live example locally, go to the Usage examples section.