php 8 client for the lemon.markets api

Overview

lemon.markets php client

This repository contains a php 8+ compatible client for the https://lemon.markets API. The documentation of the API can be found here https://docs.lemon.markets/api-endpoints/.

The API is not yet stable, therefore the client is subject to change too.

The client encapsules the basic operations from the API and maps the various responses to strongly typed models.

Installation

Since the API is changing quite frequently there won't be released versions. For now, you need to depend on the master (or a specific commit).

composer require dfreudenberger/lemon-markets-client dev-master

Usage

Make sure your composer dependencies are available to your code.

require_once 'vendor/autoload.php';

Set up the TokenClient. The client performs the request against the authentication API to retrieve an access token, given your client-id and client-secret. On top of it you need to configure the TokenCache. Even though this wouldn't be necessary it will reduce the amount of authentication requests sent to a minimum.

$tokenClient = new TokenClient('YOUR-CLIENT-ID', 'YOUR-CLIENT-SECRET');
$tokenCache = new TokenCache($tokenClient);

Last but not least, the client itself needs to be initiated.

$client = new LemonMarketsClient($tokenCache);

Examples

Place and activate an order


require_once 'vendor/autoload.php';

$tokenClient = new TokenClient('YOUR-CLIENT-ID', 'YOUR-CLIENT-SECRET');
$tokenCache = new TokenCache($tokenClient);
$client = new LemonMarketsClient($tokenCache);

$placedOrder = $client->placeOrder(new PlaceOrderCommand(
    isin: 'US29786A1060',
    validUntil: strval(time() + 3600),
    side: PlaceOrderCommand::SIDE_BUY,
    quantity: 1
));
print_r($placedOrder);

$activation = $client->activateOrder($placedOrder->uuid);
print_r($activation);

🤝 Contributing

  1. Fork it dfreudenberger/lemon-markets-client
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Running tests locally

Unit tests should exist for all critical parts of the code base. In order to run the test suite, just execute the following command in the root directory of the repository.

composer test

📝 License

This project is licensed under the MIT License.

You might also like...
PHP client for Microsoft Azure Face API.

Microsoft Azure Face API PHP client A PHP library that utilizes Azure Face REST API. Requirements PHP = 7.4 Installation composer require darmen/php-

Google PHP API Client Services

Google PHP API Client Services

PHP Client for the GoFlink API

GoFlink PHP API Client This project is an unofficial library to communicate with the GoFlink API from your PHP project. Documentation about the API is

A PHP client for the official Kizeo Forms API V3+. 📌

Kizeo Forms API V3+ - PHP This is a Swagger generated doc for Kizeo REST API 3. You can find additionnal documentation here : Online documentation. Th

Shopee Open API v2 Client build with php

Shopee PHP Client This is a Shopee PHP Client, currently supported for API V2 in ShopeeOpenPlatform Composer Install composer require haistar/shopee-p

GitLab PHP API Client
GitLab PHP API Client

GitLab PHP API Client We present a modern GitLab API v4 client for PHP. This is strongly based on php-github-api by KnpLabs. With this in mind, we now

PHP client library for the DynamicPDF Cloud API.
PHP client library for the DynamicPDF Cloud API.

PHP Client (php-client) The PHP Client (php-client) project uses the DynamicPDF Cloud API's PHP client library to create, merge, split, form fill, sta

Job Queue Public API PHP Client

Job Queue API PHP Client PHP client for the Job Queue API (API docs). Usage composer require keboola/job-queue-api-php-client use Keboola\JobQueueClie

Attempting to create an intelligent mock of the Google API PHP Client for unit and functional testing

google-api-php-client-mock A small scale intelligent mock of the Google API PHP Client for unit and functional testing. Overview This is intended to m

Comments
  • use space provided in the scope of the token

    use space provided in the scope of the token

    In order to make the API of the client easier to use the uuid of the space can be extracted from the scope of the requested access token. This allows us to remove the spaceUuid as first argument from all methods related to a space.

    opened by dfreudenberger 0
Owner
Daniel Freudenberger
Daniel Freudenberger
Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Google APIs 8.4k Dec 30, 2022
PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Sergey Bykov 63 Feb 14, 2022
Nexmo REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Client Library for PHP Support Notice This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintena

Nexmo 75 Sep 23, 2022
DigitalOcean API v2 client for Symfony and API Platform

DigitalOcean Bundle for Symfony and API Platform DunglasDigitalOceanBundle allows using the DigitalOcean API from your Symfony and API Platform projec

Kévin Dunglas 25 Jul 27, 2022
API client for ThePay - payment gate API

This is the official highly compatible public package of The Pay SDK which interacts with The Pay's REST API. To get started see examples below.

ThePay.cz s.r.o. 3 Oct 27, 2022
Code Quiz MonoRepo (API, API Client, App)

Code Quiz Welcome to the Code Quiz Open Source project from How To Code Well. This is an Open Source project that includes an API and an App for the d

How To Code Well 2 Nov 20, 2022
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Web3 PHP 665 Dec 23, 2022
A simple PHP GitHub API client, Object Oriented, tested and documented.

PHP GitHub API A simple Object Oriented wrapper for GitHub API, written with PHP. Uses GitHub API v3 & supports GitHub API v4. The object API (v3) is

KNP Labs 2k Jan 7, 2023
A simple Object Oriented PHP Client for Termii SMS API

Termii Client A simple Object Oriented PHP Client for Termii SMS API. Uses Termii API. Requirements PHP >= 7.2 Guzzlehttp ~6|~7 Installation Via Compo

Ilesanmi Olawale Adedotun 5 Feb 24, 2022
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit 96 Jan 6, 2023