Download the PHP package samrap/gemini without Composer

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

Build Status


Note: This is currently in early development and not yet ready for production purposes.


This is a PHP client implementation for the Gemini digital asset exchange REST API. It is built on expressive contracts that mirror the available public and private API methods, with a decoupled HTTP implementation for the underlying requests. If you are looking to interact with the Gemini API without worrying about the underlying HTTP requests and responses, then this package is for you.

Installation

In order to talk to the API, you will need to install a compatible HTTP client or adapter. This package utilizes HTTPlug which defines how HTTP messages should be sent and received. You can use any library to send HTTP messages that implements php-http/client-implementation.

Here is a list of all officially supported clients and adapters by HTTPlug: http://docs.php-http.org/en/latest/clients.html

Read more about HTTPlug in their docs.


Note: The Guzzle6 Adapter will be used in the following examples.


Once you have chosen your HTTP implementation, go ahead and install it with this package:

That's all you have to do to get started. The client will automatically find your chosen HTTP implementation under the hood, so you can focus on the fun stuff!

Usage

Basic Usage

In order to talk to the API, you will need to create an instance of the Samrap\Gemini\Gemini class. This class implements the API contracts necessary for you to do everything the REST API has to offer.

The class takes two arguments, a key and secret, which are your API key and secret, respectively. Of course, if you only plan on using the Public APIs, you may ignore these arguments:

The Gemini client's methods map directly to the available APIs in the documentation. For example, if you want to get data from the Symbols API, simply call the symbols method on the Gemini client:

The return value of all API calls is the HTTP response's decoded JSON as an associative array. The Gemini client handles all the HTTP requests and responses, allowing you to focus on the data that matters most.

APIs with more than one word, such as Current Order Book, are called as camelCase versions of themselves. Parameters in the URI scheme are passed as individual arguments, while URL (GET) parameters are given as an associative array. Let's take a look at what it would look like to access the public Current Order Book API:

As with all methods, the return value will be the decoded JSON from the response body. Optional URL parameters can be ignored. Since the limit_bids and limit_asks parameters are optional, we could just as easily write the following:

Piece of cake!

Private APIs

The Gemini client automatically handles authentication and request signing for you. This means that accessing the Private APIs (APIs that require a session) is just as easy as talking to the public ones. Let's place a new buy order:

That's it! If the request was successful, the value of $order will be an associative array of the response JSON. If an error occurred, the Gemini Client throws an exception representing the exact error. See Error Handling for more information.

API Reference

The Gemini client implements two contracts, Samrap\Gemini\PublicApi and Samrap\Gemini\PrivateApi. These contracts contain the API methods and their parameters, should you need a reference.

Error Handling

The Gemini client automatically converts all API errors into exceptions named after the reason in each Error Payload. An AuctionNotOpen error will throw a Samrap\Gemini\Exceptions\AuctionNotOpenException, a ClientOrderIdTooLong will throw a Samrap\Gemini\Exceptions\ClientOrderIdTooLongException, etc. Every exception extends the Samrap\Gemini\Exceptions\GeminiException. This gives you great flexibility to handle specific errors you might expect, while adding a catch-all at the end.

Imagine we are writing a method to allow users to check the status of their orders. A lot can go wrong. A user might enter the incorrect order ID, so we will need to account for that. Additionally, the API might be down for maintenance and we certainly would want to log that information. Just to be safe, we should log any other error that could occur. Ok, let's write it:

As you can see, this is much more expressive than dealing with response status codes or checking the error payload to figure out what to do next. The Gemini client handles all of this for you, allowing you to focus on the requirements of your application.

More

More documentation is coming as development continues.


All versions of gemini with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
php-http/client-implementation Version ^1.0
php-http/message Version ^1.6
php-http/discovery Version ^1.4
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 samrap/gemini contains the following files

Loading the files please wait ....