Download the PHP package conservationafrica/darwin-client without Composer

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

Darwin HTTP Client

This is an HTTP client to interact with the Darwin "REST API". Darwin is a tour operator SAAS product developed by https://eecsoftware.com

There are some rudimentary docs available at: https://darwin11.docs.apiary.io/

Things to watch out for:

Requirements & Installation

Because this lib makes use of azjezz/psl, the bcmath extension is required. composer.json lists all you need to know about dependency requirements.

Installation via composer is the only supported installation method:

Usage

Generally speaking, you should type hint on the \Darwin\Client interface so that you can stub out the client in tests.

Type inference is pretty good, not 100% but near enough. You should use Psalm or PHPStan. It will help you!

All exceptions implement a common marker interface \Darwin\DarwinError. Wrap all calls to the client with something like:

Concrete Client Construction

You'll need to construct the concrete client with your DIC, there are several constructor dependencies:

Running Tests

There are 2 test suites, Integration and Unit

To run the integration tests on a remote server, you'll need to declare the environment variables:

Remote API Method Details and Caveats

getClient method

When there are multiple "clients" that use the same email address recorded in Darwin, this method returns the most recent client amongst many. The definition of "most recent" here is effectively insertion date descending, or auto incrementing id descending.

Conversely, if you call createClient, the data will be applied to the oldest matching client, i.e. insertion date ascending.

createClient method (This is an upsert)

As noted, this method is an upsert, however, any omitted fields will erase existing data so do not consider this method a patch. For example, sending {"firstname": "foo", "lastname": "bar"} in the first request, followed by {"firstname": "new"} in the second request will yield a client record with lastname set to an empty string.

Preferred Contact Method

Docs state that the value must be "Email" or "Telephone", but you can provide an integer to the preferredcontactmethod field that matches one of the following:

getCountryList method

This endpoint is useless for identifying countries relevant to customers. It will only return a handful of countries - those that are defined by the customer.

createEnquiry method

Generally speaking, you can send any old junk with this method, providing you observe the spec outlined on the ClientInterface::EnquiryPayload psalm type.

The 6 'Country of Interest' fields must correspond to a country identifier which is not particularly helpful, (An ISO country code might have been a more sensible choice here). Not providing a valid identifier is guaranteed to resolve to a 500 error.


All versions of darwin-client with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2 || ~8.3
ext-bcmath Version *
psr/clock Version ^1.0
psr/http-client Version ^1.0.3
psr/http-message Version ^2.0
psr/http-factory Version ^1.0.2
webmozart/assert Version ^1.11
azjezz/psl Version ^2.8
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 conservationafrica/darwin-client contains the following files

Loading the files please wait ....