PHPackages                             cethyworks/invitation-bundle - 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. cethyworks/invitation-bundle

AbandonedArchivedSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

cethyworks/invitation-bundle
============================

Provides a way to secure routes behind a special 'invitation code only' security firewall.

v1.0(8y ago)2207MITPHPPHP &gt;=5.6.17

Since Jul 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Cethy/InvitationBundle)[ Packagist](https://packagist.org/packages/cethyworks/invitation-bundle)[ RSS](/packages/cethyworks-invitation-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (11)Versions (2)Used By (0)

Cethyworks/InvitationBundle
===========================

[](#cethyworksinvitationbundle)

Provides a way to secure routes behind a special "invitation code only" security firewall.

[![CircleCI](https://camo.githubusercontent.com/1a878a3ba26d3e4d2bfb25da2eca0beaaef0009563037d336ae686fdcfcbf94e/68747470733a2f2f636972636c6563692e636f6d2f67682f43657468792f496e7669746174696f6e42756e646c652f747265652f6d61737465722e7376673f7374796c653d736869656c64)](https://circleci.com/gh/Cethy/InvitationBundle/tree/master)

Install
-------

[](#install)

1\. Composer require

```
$ composer require cethyworks/invitation-bundle

```

2\. Register bundles

```
// AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Cethyworks\InvitationBundle\CethyworksInvitationBundle(),
        ];
        // ...

```

How to use
----------

[](#how-to-use)

### Invitation codes `in memory`

[](#invitation-codes-in-memory)

1\. Update `security.yml` to add the invitation provider, invitations and firewall :

```
security:
    # ...
    providers:
        in_memory_invitation_provider:
            invitation_memory:
                invitations:
                    - { code: foo }
                    - { code: bar }
    # ...
    firewalls:
        # ...
        invitation:
            pattern: ^/invite-only-url
            provider: in_memory_invitation_provider
            guard:
                authenticator:
                    cethyworks_invitation.authenticator
            anonymous: false
        # ...

```

4\. Go to `/invite-only-url?code=foo`. That's it.

#### To use emails with in memory provider :

[](#to-use-emails-with-in-memory-provider-)

1\. Update `config.yml` :

```
cethyworks_invitation:
    invitation_class: Cethyworks\InvitationBundle\Model\Invitation

```

2\. Update `security.yml` :

```
security:
        # ...
        providers:
            in_memory_invitation_provider:
                invitation_memory:
                    invitations:
                        - { code: foo, email: foo@email.foo }
                        - { code: bar, email: bar@email.bar }
        # ...

```

### Invitation codes `in database`

[](#invitation-codes-in-database)

1\. Extends `Cethyworks\InvitationBundle\Model\Invitation` to persit it :

```
