PHPackages                             alpsify/reset-password-api-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. alpsify/reset-password-api-bundle

AbandonedArchivedSymfony-bundle

alpsify/reset-password-api-bundle
=================================

Reset password logic for multiple user types over API endpoint.

v1.0.0-BETA(5y ago)05MITPHPPHP ^7.4

Since Nov 25Pushed 5y agoCompare

[ Source](https://github.com/Alpsify/reset-password-api-bundle)[ Packagist](https://packagist.org/packages/alpsify/reset-password-api-bundle)[ RSS](/packages/alpsify-reset-password-api-bundle/feed)WikiDiscussions main Synced 1w ago

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

Reset Password API Bundle
=========================

[](#reset-password-api-bundle)

ResetPasswordApiBundle is a simple way to generate API endpoints and send email to handle reset password logic of your users. Can handle multiple User types/classes.

Install the package with:

```
composer require alpsify/reset-password-api-bundle
```

Just letting you know that this bundle is inspired by the [ResetPasswordBundle](https://github.com/SymfonyCasts/reset-password-bundle). We just developed our in order to fit our needs and building way of handling many user types. If you need standard reset password logic you should go check it. And pay a beer to the creator team [Symfony Cast](https://github.com/SymfonyCasts).

Usage
-----

[](#usage)

No recipe for the moment ... Not supported by the MakerBundle yet ... That's too bad ...

We are working on both subject :)

### Setting up manually

[](#setting-up-manually)

1- Create a PHP class named `ResetPasswordRequest` which extends `AbstractResetPasswordRequest` and implements the methods registerUser() and fetchUser(). Here an example with many types of users.

```
// src/Entity/ResetPasswordRequest.php
use Alpsify\ResetPasswordAPIBundle\Model\AbstractResetPasswordRequest;
use App\Repository\ResetPasswordRequestRepository;
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity(repositoryClass=ResetPasswordRequestRepository::class)
 */
class ResetPasswordRequest extends AbstractResetPasswordRequest
{
    /**
     * @ORM\ManyToOne(targetEntity=User::class)
     * @ORM\JoinColumn(nullable=true)
     */
    private $user;

    /**
     * @ORM\ManyToOne(targetEntity=Accountant::class)
     * @ORM\JoinColumn(nullable=true)
     */
    private $accountant;

    /**
     * @ORM\ManyToOne(targetEntity=Client::class)
     * @ORM\JoinColumn(nullable=true)
     */
    private $client;

    /**
     * @return mixed
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * @param mixed $user
     */
    public function setUser($user): void
    {
        $this->user = $user;
    }

    /**
     * @return Accountant|object
     */
    public function getAccountant()
    {
        return $this->accountant;
    }

    /**
     * @param Accountant|object $accountant
     */
    public function setAccountant($accountant): void
    {
        $this->accountant = $accountant;
    }

    /**
     * @return Client|object
     */
    public function getClient()
    {
        return $this->client;
    }

    /**
     * @param Client|object $client
     */
    public function setClient($client): void
    {
        $this->client = $client;
    }

    public function registerUser(object $user): void
    {
        if($user instanceof User) {
            $this->user = $user;
        } elseif ($user instanceof Accountant) {
            $this->accountant = $user;
        } elseif ($user instanceof Client) {
            $this->client = $user;
        }
    }

    public function fetchUser(): object
    {
        if($this->user) {
            return $this->user;
        } elseif ($this->accountant) {
            return $this->accountant;
        } elseif ($this->client) {
            return $this->client;
        }
    }
}
```

Create a new migration

```
php bin/console make:migration
```

Execute the migration in order to create the table in your database

```
php bin/console make:migration
```

2- Create the repository class and make it extend `ServiceEntityRepository` implements `ResetPasswordRequestRepositoryInterface`. Don't forget to also use the `ResetPasswordRequestRepositoryTrait` : if you want to override, feel free to do so.

```
// App/Repository/ResetPasswordRequestRepository.php
use Alpsify\ResetPasswordAPIBundle\Persistence\Repository\ResetPasswordRequestRepositoryInterface;
use Alpsify\ResetPasswordAPIBundle\Persistence\Repository\ResetPasswordRequestRepositoryTrait;
use App\Entity\ResetPasswordRequest;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

class ResetPasswordRequestRepository extends ServiceEntityRepository implements ResetPasswordRequestRepositoryInterface
{
    use ResetPasswordRequestRepositoryTrait;

    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, ResetPasswordRequest::class);
    }
}
```

3- Create the reset email template. Make it shiny and colorful 🌈 🦄

```
{# templates/email/reset_password.html.twig #}
{# Here you can do what ever you want to do.

Send unicorns if you wish.

Most important you can access your token and the tokenLifetime in order
to build something helpful for your user. Like a button to redirect to the frontend page for reset password ...
#}

{{ token }}
{{ tokenLifetime }}
```

Configuration
-------------

[](#configuration)

Use the files your generate before to complete the configuration.

```
#config/packages/alpsify_reset_password.yaml
alpsify_reset_password_api:
    token:

        # Life time of the request in seconds. After that the token is invalid and the user need to ask for a new one.
        lifetime:             3600

        # Customize the selector size of the token you send.
        selector_size:        20
        hash_algo:            ~

    # Time between 2 requests.
    throttle_time:        3600

    # Describe all your user types more
    # name:
    #   class:
    user_types:           # Required

        # Prototype
        user:
            class: App\Entity\User           # Required
        ...

    persistence:

        # Class of the entity used for storing the user reset password request.
        class:                ~

        # Repository class linked to the entity
        repository:           ~
    mailer:

        # Your choosen email. The reset email will be send through this one.
        from_email:           ~

        # Your choosen name link to the email.
        from_name:            ~

        # The template used by the mailer in order the send the reset link.
        template:             ~
```

### Parameters

[](#parameters)

//TODO

### Access new API endpoints

[](#access-new-api-endpoints)

Don't forget to authorized everyone to access those endpoints by adding them in access\_controle :

```
#config/packages/security.yaml

...

    access_control:
      - { path: ^/api/request-reset-password, roles: PUBLIC_ACCESS, methods: [POST] }
      - { path: ^/api/reset-password, roles: PUBLIC_ACCESS, methods: [POST] }
      ...
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

2000d ago

### Community

Maintainers

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

---

Top Contributors

[![nathan-de-pachtere](https://avatars.githubusercontent.com/u/6233770?v=4)](https://github.com/nathan-de-pachtere "nathan-de-pachtere (11 commits)")

### Embed Badge

![Health badge](/badges/alpsify-reset-password-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/alpsify-reset-password-api-bundle/health.svg)](https://phpackages.com/packages/alpsify-reset-password-api-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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