Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Change Password Laravel Package

hardikkhorasiya09/change-password

A Laravel package that simplifies letting users change their password, providing ready-made validation, current-password checks, and configurable routes and views so you can add secure password updates to your app with minimal setup.

View on GitHub
Deep Wiki
Context7

Getting Started

Since v1.0.0 is the initial tagged release, treat it as a fresh install with no upgrade path — there is nothing to migrate from, and no deprecations to work around yet.

  1. Install the package:
    composer require hardikkhorasiya09/change-password
    
  2. Look at the package's src/ root first. For a package of this shape the entry point is almost always a service provider (ChangePasswordServiceProvider) that registers routes, config, views, and translations. That file tells you in one read whether routes are auto-loaded or opt-in.
  3. Publish anything publishable before writing code:
    php artisan vendor:publish --provider="HardikKhorasiya09\ChangePassword\ChangePasswordServiceProvider"
    
    Check whether --tag=config, --tag=views, and --tag=lang exist separately; publishing only the config is usually the right first move, since the views are often fine to consume as-is.
  4. Inspect the registered routes:
    php artisan route:list --path=password
    
    This is the fastest way to learn the actual URI, HTTP verbs, middleware stack, and route names the package ships with. Do not assume the names — read them.
  5. First use case: an authenticated user changing their own password from a settings page. Wire the shipped route (or the shipped form partial) behind your existing auth middleware group, submit the form, and confirm the password actually changes. That single loop validates routing, the trait/contract on your User model, and hashing.

The README's usage snippet is the contract. If the package expects a trait on your User model or a contract implementation, do that before anything else — most "it silently does nothing" reports trace back to a skipped trait.

Implementation Patterns

Trait on the model, not logic in the controller. If the package ships a ChangePassword trait (or similar), add it to App\Models\User and call the provided method from your own controller. This keeps the package's validation and hashing assumptions in one place and lets you swap the UI freely.

use HardikKhorasiya09\ChangePassword\Traits\ChangePassword;

class User extends Authenticatable
{
    use ChangePassword;
}

Wrap the package's form in your own Blade layout. The shipped view is a starting point. Publish it, extend your app layout, keep your own error/session-flash partials, and leave the field names and @csrf/@method directives exactly as shipped — renaming inputs is the most common way to break validation wiring.

Custom controller over shipped routes when you need policy. If the package auto-registers routes, you have two options: use them, or disable them (usually a config flag like routes.enabled => false) and point your own route at the package's action/controller. Prefer the second as soon as you need authorization checks, audit logging, or a different redirect target. Registering the package route and then fighting its redirect in a middleware is the worse pattern.

Always require the current password. The valuable part of this package is the current_password verification step. If you build a custom flow, keep that check — never allow a password change on session alone without re-authentication, especially for users with long-lived "remember me" cookies.

Dispatch your own side effects in a listener. Rather than editing package internals, hook the password-changed event (if one is dispatched) or wrap the call:

$user->updatePassword($request->validated());

event(new PasswordChanged($user)); // your own event for audit log / email notice

Sending a "your password was changed" notification email is standard practice and cheap to add.

Pair with session invalidation. After a successful change, re-login the user or cycle the session ID, and consider Auth::logoutOtherDevices($newPassword). Forcing other sessions out is expected behaviour for a password change and is not something the package can do for you.

Gotchas and Tips

Double hashing is the classic failure. Laravel 10+ casts password => 'hashed' on the model. If the package also calls Hash::make() internally, you get a hash of a hash and the user can never log in again. Test immediately after install: change the password, log out, log back in. If it fails, remove the hashed cast or the package's hashing — check which one owns it before shipping.

Validation rule set matters. Confirm the package enforces current_password, a confirmed field matching password_confirmation, and a minimum length. If it ships validation you disagree with (e.g. no Password::defaults() integration), override the FormRequest in your own controller rather than editing vendor code.

Config caching on deploy. Any published config file must be followed by php artisan config:cache in your deploy script — and conversely, a stale cached config is why a changed setting appears to do nothing locally. Same for route:cache if the package registers closures, which are not cacheable; that surfaces as a deploy-only failure.

Route name collisions. Auto-registered routes with generic names (password.update, password.change) can silently shadow or be shadowed by Breeze/Fortify/Jetstream, which use the same names. Run php artisan route:list and check for duplicates before assuming the package's controller is what ran.

Middleware and guest access. Verify the shipped routes sit behind auth. A password-change endpoint reachable by guests is an information-disclosure and abuse vector. If the package leaves middleware configurable, set it explicitly in config rather than trusting the default.

Rate limit the endpoint. Password change is a credential-verification endpoint — unlimited attempts against current_password is an online guessing oracle. Add throttle: middleware to whichever route serves it.

v1.0.0 semver reality. A brand-new 1.0.0 from a single-maintainer package frequently has API churn in the 1.x line. Pin the version in composer.json ("^1.0" is reasonable, but avoid *), and read the changelog before every minor bump. There are no deprecations in this release, so any breaking change you hit later will arrive without a warning shim.

Debugging checklist when nothing happens: (1) trait present on the model, (2) config published and cached correctly, (3) route middleware includes auth, (4) form field names unchanged, (5) CSRF token present, (6) APP_DEBUG on so the actual exception surfaces. Nine times out of ten the submit is hitting a 419 or 403 that a custom error page is swallowing.

Extension points to prefer, in order: published config → published views → your own controller calling the package's service/method → a listener on the package's event. Reach for vendor-file edits last, and if you do patch something, note it in the repo — composer update will erase it.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings