Download the PHP package bluerocktel/php-sdk without Composer

On this page you can find all versions of the php package bluerocktel/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

php-sdk

Latest Version on Packagist Total Downloads

This package is a light PHP Wrapper / SDK for the BlueRockTEL Admin API.

Installation

This library requires PHP >=8.1.

You can install the package via composer:

Authentication

BlueRockTEL APIs supports OAuth2 for authentication. However, this package currently only supports the Password Grant authentication flow.

Client Code Grant

Not supported yet.

Password Grant

To connect using your usual BlueRockTEL credentials, first initiate the BlueRockTELConnector class providing your instance URL, email and password :

If the connector fails to retrive a Bearer token from the provided credentials, a BlueRockTEL\SDK\Exceptions\AuthenticationException will be thrown.

Otherwise, you can start testing the API by calling the version() method of Helper resource :

Usage

To query the API, you can either call each API Endpoints requests individually, or make use of provided Resources classes which groups the requests into clusters.

Using Requests

Using single requests is pretty straightforward. You can use the call() method of the BlueRockTELConnector class to send the desired request to the instance :

Using Resources

Using resources is a more convenient way to query the API. Each Resource class groups requests by specific API namespaces (Customer, Prospect...).

Resources classes usually provide (but are not limited to) the following methods :

👉 The upsert() method is a simple alias : it will call the update() method if the given entity has an id, or the store() method if not.

Each of those namespace resources can be accessed using the BlueRockTELConnector instance :

If needed, it is also possible to create the desired resource instance manually.

Responses

Weither you are using Requests or Resources, the response is always an instance of Saloon\Http\Response class. It provides some useful methods to check the response status and get the response data.

You can learn more about responses by reading the Saloon documentation, which this SDK uses underneath.

Entities (DTO)

When working with APIs, dealing with a raw or JSON response can be tedious and unpredictable.

To make it easier, this SDK provides a way to transform the response data into a Data Transfer Object (DTO) (later called Entities). This way, you are aware of the structure of the data you are working with, and you can access the data using object typed properties instead of untyped array keys.

Although you can use the dto() method to transform the response data into an entity, it is recommended to use the dtoOrFail() method instead. This method will throw an exception if the response status is not 2xx, instead of returning an empty DTO.

It is still possible to access the underlying response object using the getResponse() method of the DTO :

Learn more about working with Data tranfert objects on the Saloon documentation.

The create/update/upsert routes will often ask for a DTO as first parameter :

Pagination

On some index/search routes, the BlueRockTEL API will use a pagination. If you need to iterate on all pages of the endpoint, you may find handy to use the connector's paginate() method :

Read more about lazy paginations on the Saloon documentation.

Extending the SDK

You may easily extend the SDK by creating your own Resources, Requests, and Entities.

Then, by extending the BlueRockTELConnector class, add you new resources to the connector :


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
nesbot/carbon Version ^2.68
illuminate/collections Version >=9.0
saloonphp/saloon Version ^3.0
saloonphp/rate-limit-plugin Version ^2.0
saloonphp/pagination-plugin Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bluerocktel/php-sdk contains the following files

Loading the files please wait ....