Download the PHP package betalabs/engine-phpsdk without Composer

On this page you can find all versions of the php package betalabs/engine-phpsdk. 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 engine-phpsdk

Engine-PhpSDK

Buddy Status

This package is a helper to integrate with Engine. The documentation for integration can be found here.

Request

The Betalabs\Engine\Request class is responsible for initializing the request specific types objects. If you need to make a GET request call you can:

It's also possible to inject the Betalabs\Engine\Request:

There are five methods possible: GET, POST, PUT, PATCH and DELETE. In all methods the first parameter is the API path. For POST, PUT, PATCH and DELETE the second parameter is the data to be sent to the API, it must be sent in an array. For instance:

URL builder

By default the package always adds the api prefix to all URLs. In the previous example the URL will be (assuming http://engine.url is the endpoint): http://engine.url/api/path/to/api.

It is possible to change this behavior adding using setEndpointSuffix() method which accepts a string or null:

Configuration file

Configuration file is expected to be stored in the main (root) directory of the project and shall be named engine-sdk.xml.

This is its basic format:

Each section of this document will relate to its configuration.

Routes

All routes must be declared in one single file which implements Betalabs\Engine\RouteProvider interface. The route method receives a Aura\Router\Map parameter, its usage can be checked here.

The location of route file is declared in configuration file:

Where path is the relative path to the file (based on the root directory) and class is the class name (with namespace if exists). The path is not required when the class is autoloaded.

Engine requests

All requests to the App are dispatched by the Engine, these requests might be originated by an trigger or an authenticated user. However, for some applications, it might be useful to own some endpoints for loose requests (that are not directly dispatched by Engine).

Assume we are building an app that creates a tag for an order named TagCreator; there are two main starters: (1) An Engine user is managing the orders and click in "Make tag"; (2) An external system wants to generate a tag.

In the first case Engine owns a trigger to dispatch an request to the app. In this request Engine will add some information to identify which order the user wants to generate the tag (such as the ID) and via Engine requests is possible to gather all information to response the request with the tag. The second case the app must own a route prepared to receive all information via request parameter and then generate the tag.

Note in the second case Engine does not take any action and is not used to generate any data. To make a request directly to the app dispatch to: http://{app-company}-{app-repository}.engine.url/ where {app-company} and {app-repository} are GitHub's Company and Repository name (used to register app in Engine).

Authentication

By default all requests are authenticated using stored token. It is possible to disable using mustNotAuthorize method:

Of course is possible to enable using the mustAuthorize() method.

Permissions

During the App boot process Engine asks for the permissions. There is an easy way to define them where you must create a class that implements Betalabs\Engine\PermissionProvider. This class must own a method that adds all permissions:

The location of this file is declared in configuration file:

Where path is the relative path to the file (based on the root directory) and class is the class name (with namespace if exists). The path is not required when the class is autoloaded.

If this node does not exist or no permission is declared then an 404 HTTP code is returned to Engine when it asks for the permission.

By default the boot/permission route is automatically defined and treated by the SDK.

Database migration

During the App boot process Engine starts migration process. You can create a class that implements Betalabs\Engine\MigrationProvider. This class must own a method that runs the migration:

It is necessary to return an Betalabs\Engine\Requests\BootResponse object, this way Engine will be able to log what happen during this process.

The location of this file is declared in configuration file:

Where path is the relative path to the file (based on the root directory) and class is the class name (with namespace if exists). The path is not required when the class is autoloaded.

If this node does not exist then SDK informs Engine no migration process is needed.

By default the boot/database route is automatically defined and treated by the SDK.

Genesis boot

During process of associate an App with a tenant Engine boot Genesis process. You can create a class that implements Betalabs\Engine\GenesisProvider. This class must own a method that runs the migration:

It is necessary to return an Betalabs\Engine\Requests\BootResponse object, this way Engine will be able to log what happen during this process.

The location of this file is declared in configuration file:

Where path is the relative path to the file (based on the root directory) and class is the class name (with namespace if exists). The path is not required when the class is autoloaded.

If this node does not exist then SDK informs Engine no genesis process is needed.

By default the boot/genesis route is automatically defined and treated by the SDK.

Development

During development you might want to manually define tokens and endpoints. It is possible using configuration file.

Endpoint

By default all requests are dispatched against production URL however you can change this behavior using environment section in configuration file.

env node can be filled with two values: Sandbox or Production; this way the endpoint URL will be automatically defined. Nevertheless if you fill endpoint node this value will be used as endpoint URL independently env node value.

environment, env and endpoint nodes are not required.

Token

You might want to use a specific token to access Engine API. This can be done through auth section in configuration file:

The auth node is not required, however to be used accessToken subnode, it must be declared.


All versions of engine-phpsdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
php-di/php-di Version ^5.4|^6.0
nesbot/carbon Version ^2.26
aura/router Version ^3.1
symfony/cache Version ^5.1 || ^6.0
symfony/http-kernel Version ^5.1 || ^6.0
symfony/mime Version ^5.1|| ^6.0
symfony/http-foundation Version ^5.1 || ^6.0
symfony/var-dumper Version ^5.1 || ^6.0
symfony/var-exporter Version ^5.1 || ^6.0
predis/predis Version ^1.1
phpdocumentor/reflection-docblock Version ^5.1
phpdocumentor/type-resolver Version ^1.4.0
betalabs/guzzle6-adapter Version ^4.0.0
laminas/laminas-diactoros Version ^2.25
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 betalabs/engine-phpsdk contains the following files

Loading the files please wait ....