PHPackages                             eltharin/invitations - 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. eltharin/invitations

ActiveSymfony-bundle

eltharin/invitations
====================

invitations Bundle for symfony

V1.4.4(1mo ago)165GPL-3.0PHP

Since Jul 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/eltharin/Invitations)[ Packagist](https://packagist.org/packages/eltharin/invitations)[ RSS](/packages/eltharin-invitations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (17)Used By (0)

Symfony Invitaitons Bundle
==========================

[](#symfony-invitaitons-bundle)

[![Latest Stable Version](https://camo.githubusercontent.com/24ca1d07812f41988cb2fd4f9f1cce25721388230d2e6e5509cb530071bf860b/687474703a2f2f706f7365722e707567782e6f72672f656c74686172696e2f696e7669746174696f6e732f76)](https://packagist.org/packages/eltharin/invitations)[![Total Downloads](https://camo.githubusercontent.com/67588d980e7aca692323a7b35b90668ffe25a7620d83ee71d805e0e3ca01dd4a/687474703a2f2f706f7365722e707567782e6f72672f656c74686172696e2f696e7669746174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/eltharin/invitations)[![Latest Unstable Version](https://camo.githubusercontent.com/67ba28b9fe87a24f007e5dd96193d1dccdd3eb21bac43a92659ee050e7219319/687474703a2f2f706f7365722e707567782e6f72672f656c74686172696e2f696e7669746174696f6e732f762f756e737461626c65)](https://packagist.org/packages/eltharin/invitations)[![License](https://camo.githubusercontent.com/2e489434b0eb0ecabf4fb4d093a2615198f0702c404600b2ef2d6954d255d047/687474703a2f2f706f7365722e707567782e6f72672f656c74686172696e2f696e7669746174696f6e732f6c6963656e7365)](https://packagist.org/packages/eltharin/invitations)

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

[](#installation)

- Require the bundle with composer:

```
composer require eltharin/invitaitons

php bin/console make:migration
php bin/console d:m:m

to create invitaitons table
```

What is Invitations Bundle?
---------------------------

[](#what-is-invitations-bundle)

This bundle will help you to work with chained mail actions.

When you have to send a mail for allowing an action this bundle will helps you.

How to ?
--------

[](#how-to-)

For the example we will set the forget-password workflow:

- User go to page /forget-password
- type his mail
- receive a mail a clic on the link inside
- set his new password
- enjoy

no changes is required on User entity just a new table for all invitations.

create a FormType for reset password with just an email asked and one other for the new password :

```
class ForgetPasswordType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('email', EmailType::class, [
				'label' => 'Type your email'
            ])
        ;
    }
}

class ResetPasswordType extends AbstractType
{
	public function buildForm(FormBuilderInterface $builder, array $options): void
	{
		$builder
			->add('password', PasswordType::class, [
				'label' => 'Type the new password',
				'help_html' => true,
			])
		;
	}
}
```

now we will create an "Invitation": Class must extends from AbstractInvitation, that tag it automaticly with app.invitation

```
class ResetPassword extends AbstractInvitation
{
	public function setMailContent(TemplatedEmail $email, InvitationEntityManager $invitationEntityManagerManager): void
	{
		$email->subject('Reset password')
			->htmlTemplate('mail/invitations/resetpassword.html.twig');
	}

	public function resolve(InvitationEntityManager $invitationEntityManagerManager): bool
	{
	    // nothing here all is treated in controller
		return true;
	}

	public function getResolvePath(InvitationEntityManager $invitationEntityManagerManager) : array
	{
		return [
			'path' => 'app_reset_password',
			'args' => ['id' => $invitationEntityManagerManager->getInvitation()->getId(), 'token' => $invitationEntityManagerManager->getInvitation()->getToken()],
		];
	}

	public function resendMailIfAlreadyExists(): bool
	{
		return true;
	}
}
```

the mail template will contains the link :

```
Reset your password :
Link
```

now the first route in security controller for show the form and send the mail :

```
	#[Route(path: '/forget-password', name: 'app_forget_password')]
	public function forgetPassword(
		Request $request,
		UserRepository $userRepository,
		InvitationManager $invitationManager
	): Response
	{
		$form = $this->createForm(ForgetPasswordType::class);
		$form->handleRequest($request);

		if($form->isSubmitted() && $form->isValid())
		{
			$user = $userRepository->findOneByEmail($form->get('email')->getData());

			if($user != null)
			{
				$invitationManager->create(ResetPassword::class, $user, $form->get('email')->getData(),0);
			}

			return $this->render('message.html.twig', [
				'message' => 'If you mail is on our base, we sent you a message for reset your password',
			]);
		}

		return $this->render('security/reset_password/reset_password_request.html.twig', [
			'form' => $form->createView()
		]);
	}
```

Now the route call when link inside mail is clicked :

```
	#[Route(path: '/reset-password', name: 'app_reset_password')]
	public function resetPassword(
		Request $request,
		InvitationManager $invitationManager,
		EntityManagerInterface $em,
		UserPasswordHasherInterface $passwordHasher
	): Response
	{
		$invitation = $invitationManager->getInvit($request->query->get('id'), ['type' => [ResetPassword::class], 'token' => $request->query->get('token')]);
		if($invitation == null)
		{
			throw new ItemNotFoundException('Unkwnon Invitation');
		}

		$user = $invitation->getInvitation()->getUser();
		$form = $this->createForm(ResetPasswordType::class, $user, ['action' => $invitation->getResolvePath(true)]);
		$form->handleRequest($request);

		if($form->isSubmitted() && $form->isValid())
		{
			$user->setPassword($passwordHasher->hashPassword($user,$user->getPassword()));
			$em->flush();

			$invitation->resolve(true);

			$this->addFlash('success', 'Your password has been changed.');
			return $this->redirectToRoute('app_login');
		}

		return $this->render('security/reset_password/reset_password_request.html.twig', [
			'form' => $form->createView()
		]);
	}
```

As you can see you have to write code for the logic of the action you want but nothing for send a mail, get the token, reteive for witch user, all is done for you.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~89 days

Recently: every ~174 days

Total

16

Last Release

47d ago

Major Versions

V0.1.0 → V1.0.02022-11-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/fff318a46a2e2f50b3a9fb70ee232f3dc317397c0b9dea4f0ed8ac37160dc471?d=identicon)[eltharin](/maintainers/eltharin)

---

Top Contributors

[![eltharin](https://avatars.githubusercontent.com/u/7547802?v=4)](https://github.com/eltharin "eltharin (17 commits)")

---

Tags

symfonybundlewebcssJS

### Embed Badge

![Health badge](/badges/eltharin-invitations/health.svg)

```
[![Health](https://phpackages.com/badges/eltharin-invitations/health.svg)](https://phpackages.com/packages/eltharin-invitations)
```

###  Alternatives

[twitter/bootstrap

The most popular front-end framework for developing responsive, mobile first projects on the web.

174.1k1.7M27](/packages/twitter-bootstrap)[onokumus/metismenu

A jQuery menu plugin

2.0k263.3k5](/packages/onokumus-metismenu)[robertotru/to-inline-style-email-bundle

A Symfony2 bundle for using the CssToInlineStyles translator by tijsverkoyen

59384.3k](/packages/robertotru-to-inline-style-email-bundle)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)[onokumus/metismenujs

A menu plugin

13210.2k](/packages/onokumus-metismenujs)[spomky-labs/web-push

Web-Push framework for PHP

281.8k](/packages/spomky-labs-web-push)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
