This package is abandoned and no longer maintained. No replacement package was suggested.

Cryptographically sign data to prevent tampering.

1.1.0 2015-02-12 23:30 UTC

This package is auto-updated.

Last update: 2021-06-06 08:55:19 UTC


Source Latest Stable Version Total Downloads Open Issues Build Status Coverage Status Code Climate Code Quality Dependency Status SensioLabsInsight HHVM Support License Author

The Signer class is designed for those who are signing data on behalf of a public-private keypair.

In principle, the "client party" has public key (i.e., client_id) and a matching private key (i.e., client_secret) that can be verified by both the signer and the client (but nobody else as we don't want to make forgeries possible).

The "signing party" has a simple identifier which acts as an additional piece of entropy in the algorithm, and can help differentiate between multiple signing parties if the client party does something like try to use the same public-private keypair independently of a signing party (as is common with GPG signing).

Based on a simplified version of the AWS Signature v4.


use Skyzyx\Signer\Signer;

$self_key = 'Skyzyx';
$client_id = 'k3qDQy0Tr56v1ceo';
$client_secret = 'O5j@pG@Jt%AzyiJTEfo!£LSz8yqSj)JX)S6FvW%58KjlS9bc%Fi7&&C4KSCT8hxd';

$signer = new Signer($self_key, $client_id, $client_secret, 'sha512');
$signature = $signer->sign([
    'ClientID' => $client_id,
    'Domain'   => '',
    'Path'     => '/',
    'Expires'  => 'Wed, 13 Jan 2021 22:23:01 GMT',
    'Secure'   => null,
    'HttpOnly' => null,

$signature = wordwrap($signature, 64, "\n", true);
#=> dfbffab5b6f7156402da8147886bba3eba67bd5baf2e780ba9d39e8437db7c47
#=> 35e9a0b834aa21ac76f98da8c52a2a0cd1b0192d0f0df5c98e3848b1b2e1a037


Using Composer:

composer require skyzyx/signer=^1.0.0

And include it in your scripts:

require_once 'vendor/autoload.php';


Firstly, run composer install -o to download and install the dependencies.

You can run the tests as follows:


Debug Logging

NOTE: You should only use logging during development — never in production.

Signer implements the PSR-3 Psr\Log\LoggerAwareInterface. Because of this, you can inject any PSR-3-compatible logging package, and Signer will use it to log DEBUG-level messages.

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Skyzyx\Signer\Signer;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));

// inject a logger
$signer = new Signer();

$signer->sign( ... );

API Reference

The API Reference is generated by a tool called phpDocumentor 2.x. You should install it locally on your system with:

cd /usr/local/bin &&
wget &&
chmod +x phpDocumentor.phar &&
mv phpDocumentor.phar phpdoc

Once it's installed, you can generate updated documentation by running the following command in the root of the repository.



Here's the process for contributing:

  1. Fork Signer to your GitHub account.
  2. Clone your GitHub copy of the repository into your local workspace.
  3. Write code, fix bugs, and add tests with 100% code coverage.
  4. Commit your changes to your local workspace and push them up to your GitHub copy.
  5. You submit a GitHub pull request with a description of what the change is.
  6. The contribution is reviewed. Maybe there will be some banter back-and-forth in the comments.
  7. If all goes well, your pull request will be accepted and your changes are merged in.

Authors, Copyright & Licensing

See also the list of contributors who participated in this project.

Licensed for use under the terms of the Apache 2.0 license.

Coding Standards

PSR-0/1/2 are a solid foundation, but are not an entire coding style by themselves. I have taken the time to document all of the nitpicky patterns and nuances of my personal coding style. It goes well-beyond brace placement and tabs vs. spaces to cover topics such as docblock annotations, ternary operations and which variation of English to use. It aims for thoroughness and pedanticism over hoping that we can all get along.