league/openid-connect-claims

An OpenID Connect ID claims set implementation

1.1.0 2016-05-26 14:29 UTC

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

An OpenID Connect claims set implementation

Install

Via Composer

$ composer require league/openid-connect-claims

Usage

$claims = new \League\OpenIdConnectClaims\ClaimsSet();
$claims->setIdentifier(123);
$claims->setFirstName('Alex');
$claims->setLastName('Bilbie');
$claims->setNickname('Alex');
$claims->setUsername('alexbilbie');
$claims->setProfileUrl('http://twitter.com/alexbilbie');
$claims->setPictureUrl('https://s.gravatar.com/avatar/14902eb1dac66b8458ebbb481d80f0a3');
$claims->setWebsite('http://alexbilbie.com');
$claims->setEmail('hello@alexbilbie.com');
$claims->setEmailVerified(true);
$claims->setGender('male');
$claims->setBirthDate('YYYY', 'MM', 'DD');
$claims->setZoneInfo('Europe/London');
$claims->setLocale('en_GB');
$claims->setPhoneNumber('0303 123 7300');
$claims->setPhoneNumberVerified(true);
$claims->setAddressStreet('Buckingham Palace');
$claims->setAddressRegion('London');
$claims->setAddressPostalCode('SW1A 1AA');
$claims->setAddressCountry('United Kingdom');

When the ClaimsSet object is JSON encoded you will get an object similar to this:

{
    "sub": "123",
    "name": "Alex Bilbie",
    "given_name": "Alex",
    "family_name": "Bilbie",
    "nickname": "Alex",
    "preferred_username": "alexbilbie",
    "profile": "http:\/\/twitter.com\/alexbilbie",
    "picture": "https:\/\/s.gravatar.com\/avatar\/14902eb1dac66b8458ebbb481d80f0a3",
    "website": "http:\/\/alexbilbie.com",
    "email": "hello@alexbilbie.com",
    "email_verified": true,
    "gender": "male",
    "birthdate": "YYYY-MM-DD",
    "zoneinfo": "Europe\/London",
    "locale": "en_GB",
    "phone_number": "0303 123 7300",
    "phone_number_verified": true,
    "address": {
        "street_address": "Buckingham Palace",
        "region": "London",
        "postal_code": "SW1A 1AA",
        "country": "United Kingdom"
    }
}

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email hello@alexbilbie.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.