2017 © Pedro Peláez
 

library monk-id

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

image

monkdev/monk-id

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

  • Friday, March 3, 2017
  • by jstayton
  • Repository
  • 16 Watchers
  • 2 Stars
  • 7,254 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

Monk ID PHP

Latest Stable Version Build Status Coverage Status Dependency Status, (*1)

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side., (*2)

Overview

Install

Using Composer, add monkdev/monk-id to your composer.json:, (*3)

{
  "require": {
    "monkdev/monk-id": "~1.0"
  }
}
$ composer update

Or:, (*4)

$ composer require monkdev/monk-id:~1.0

Configure

Configuration is done in an external INI file. There's a sample file in this repository: config/monkId.sample.yml. Copy this file to your codebase, then load the config in your code during initialization:, (*5)

Monk\Id::loadConfig('/path/to/monkId.ini', 'development');

Remember, replace the sample values with your own, and keep the file safe as it contains your app secret., (*6)

Access

If you have Monk ID JS configured to store the payload automatically in a cookie (the default), you can skip the next part as the cookie is also loaded automatically., (*7)

If not, the encoded payload can be passed directly, which is useful if you're sending it in a GET/POST request instead:, (*8)

Monk\Id::loadPayload($monkIdPayload);

Loading the payload must be done before trying to access any values stored in the payload. In an MVC framework, this usually means placing it in a method in your ApplicationController that's executed before the specific action is processed., (*9)

Once the payload is loaded, you can ask whether the user is logged in:, (*10)

Monk\Id::loggedIn()

Or for their ID and email:, (*11)

Monk\Id::userId()
Monk\Id::userEmail()

null is returned if the user isn't logged in or the payload can't be decoded and verified., (*12)

Development

Composer is used for dependency management and task running. Start by installing the dependencies:, (*13)

$ composer install

Tests

Testing is done with PHPUnit. To run the tests:, (*14)

$ composer test

Continuous integration is setup through Travis CI to run the tests against PHP v5.6, v7.0, and v7.1. (Circle CI is also setup to run the tests against PHP v5.6, but is backup for now until multiple versions can easily be specified.) The code coverage results are sent to Coveralls during CI for tracking over time. Badges for both are dispayed at the top of this README., (*15)

While the test suite is complete, it's not a bad idea to also test changes manually in real-world integrations., (*16)

Documentation

phpDocumentor is used for code documentation. To build:, (*17)

$ composer phpdoc

This creates a doc directory (that is ignored by git)., (*18)

Quality

A number of code quality tools are configured to aid in development. To run them all at once:, (*19)

$ composer quality

Each tool can also be run individually:, (*20)

Deployment

Publishing a release to Packagist simply requires creating a git tag:, (*21)

$ git tag -a vMAJOR.MINOR.PATCH -m "Version MAJOR.MINOR.PATCH"
$ git push origin vMAJOR.MINOR.PATCH

Be sure to choose the correct version by following Semantic Versioning., (*22)

Publish Documentation

After releasing a new version, the documentation must be manually built and published to the gh-pages branch., (*23)

The Versions

03/03 2017

dev-dev

dev-dev https://github.com/MonkDev/monk-id-php

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

signup login logout id monk signin monkdev monkid signout

11/01 2017

dev-master

9999999-dev https://github.com/MonkDev/monk-id-php

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

signup login logout id monk signin monkdev monkid signout

11/01 2017

v1.1.0

1.1.0.0 https://github.com/MonkDev/monk-id-php

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

signup login logout id monk signin monkdev monkid signout

28/08 2014

v1.0.1

1.0.1.0 https://github.com/MonkDev/monk-id-php

Integrate Monk ID authentication and single sign-on for apps and websites on the server-side.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

signup login logout id monk signin monkdev monkid signout

21/01 2014

v1.0.0

1.0.0.0 https://github.com/MonkDev/monk-id-php

Integrate Monk ID on the server-side by accessing payloads from the client-side JavaScript.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

signup login logout id monk signin monkdev monkid signout