This is a client api for command line as a reference implementation for the Double-Opt-in client api.

1.0.3 2015-06-24 06:52 UTC

This package is auto-updated.

Last update: 2022-06-23 01:11:26 UTC


Latest Stable Version Latest Unstable Version License Total Downloads

This is a demonstration package for die Client API in PHP for the service.

You get an console application to manage your account for a site.


Add to your composer.json following lines

"require": {
	"double-opt-in/cli-client-php": "~1.0"


You can call vendor/bin/doi-cli to see all your options and commands. It is a symfony console application. So just ask when you do not understand what is going on there. Or use the manual for symfony console component.


This is just for demonstration, so to configure the console application is a bit hard. You have to create a config.php file within the vendor/bin folder with the following content:


return array(
	'api' => '',
	'client_id' => 'YOUR_CLIENT_ID',
	'client_secret' => 'YOUR_CLIENT_SECRET',
	'site_token' => 'YOUR_SITE_TOKEN',

This is not so convenient, but it is okay for demonstrating the PHP client api.

Built-in commands

Listing all built-in commands:

$> ./vendor/bin/doi-cli

Logging an action

Retrieving all arguments and options:

$> ./vendor/bin/doi-cli help log

Logging an email with action:

$> ./vendor/bin/doi-cli log register

Logging an email with action and scope:

$> ./vendor/bin/doi-cli log register --scope="newsletter"

Retrieving all actions

Getting help for the command:

$> ./vendor/bin/doi-cli help actions

Getting actions for email:

$> ./vendor/bin/doi-cli actions

Validate an email

Getting help for the command:

$> ./vendor/bin/doi-cli help validate

Validate an email:

$> ./vendor/bin/doi-cli validate

Status request

Getting help for the command:

$> ./vendor/bin/doi-cli help status

Retrieving status information:

$> ./vendor/bin/doi-cli status

Possible Result can be like this:

| key                 | value                |
| site                | ipunkt |
| type                | premium              |
| storage_time        | 315360000            |
| credits             | 10857964             |
| soft_quota          | 5000                 |
| hard_quota          | -2500                |
| daily_credits_usage | 253                  |
| unique_hashes       | 17563                |

The extra sugar

If you add the verbose flag -v to a command you can get the current rate limiting information as well. E.g.:

999 / 1000 (new reset in 60 seconds)