PHPackages                             taproot/authentication - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. taproot/authentication

Abandoned → [taproot/indieauth](/?search=taproot%2Findieauth)Library[Authentication &amp; Authorization](/categories/authentication)

taproot/authentication
======================

Makes adding indieauth login (client app) and token generation (server app) to your Silex/Symfony app as easy as it should be.

v0.2.0(5y ago)4811[1 PRs](https://github.com/taproot/authentication/pulls)MITPHPCI passing

Since May 9Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/taproot/authentication)[ Packagist](https://packagist.org/packages/taproot/authentication)[ RSS](/packages/taproot-authentication/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

Abandoned!
==========

[](#abandoned)

taproot/authentication is deprecated and no longer maintained. Future development will happen in the newer, more compatible and better tested [taproot/indieauth](https://github.com/Taproot/indieauth)

taproot/authentication
======================

[](#taprootauthentication)

A library for quickly adding full-blown [indieauth](http://indieauth.com)/web sign-in support to Silex/Symfony applications. Built on top of [indieweb/indieauth-client](https://github.com/indieweb/indieauth-client-php).

Installation
------------

[](#installation)

Install using [Composer](https://getcomposer.org):

```
./composer.phar require taproot/authentication:~0.1

```

Usage
-----

[](#usage)

taproot/authentication exposes two functions, which, given your Silex `$app`, set up pre/post request handlers and return a route collection which you can mount wherever you like.

Both functions require several services on `$app`:

- `url_generator`: a Symfony Routing UrlGeneratorInterface instance, e.g. one provided by a UrlGeneratorServiceProvider in Silex.
- `encryption`: an object implementing two methods, `string encrypt(mixed $data)` and `mixed decrypt(string $token)` capable of encrypting and decrypting arbitrary data. Usually an instance of `[Illuminate\Encryption\Encrypter](https://github.com/illuminate/encryption)`

Both functions will optionally make use of the following services, but do not require them to function:

- `logger`: a [PSR-3](http://www.php-fig.org/psr/psr-3/)-compatible logging interface

### Taproot\\Authentication\\client()

[](#taprootauthenticationclient)

`client()` implements the logic and routes required for users to log into your app using their domains, and optionally grant it permissions (e.g. to use micropub to post new content to their website).

It returns a RouteCollection ready to be mounted wherever you want, containing the following routes:

- `/login/` (indieauth.login) — POST to this URL with required “me” and optional “next” parameters to start the login process
- `/authorize/` (indieauth.authorize) — the URL redirected to by the user’s authorization server after successful authorization. Checks details and sets remember-me cookie
- `/logout/` (indieauth.logout) — POST to this URL (with optional “next” parameter) whilst logged in to log out, i.e. remove the remmeber-me cookies.

```
