creonit/verification-code-bundle
MyCodeGenerator) demonstrate the bundle’s flexibility for domain-specific logic (e.g., alphanumeric codes, QR-based verification).ConfigurableInterface, GeneratorInterface) that Laravel’s service container can resolve. Works with Laravel’s routing (routes.yaml → web.php equivalent).config/services.php or a custom provider.Verifying, Verified), requiring custom event dispatching.config/verification.php conventions. Requires mapping to Laravel’s config system.InvalidConfigurationException).throttle middleware or packages like spatie/rate-limiter).Notifiable interface (e.g., sending codes via Mailable or Notification).MustVerifyPhoneTrait)?scheduler or Redis TTL)?Verifying, Verified)?symfony/dependency-injection and symfony/config components.Authenticatable or MustVerifyPhoneTrait.Notification system to send codes (e.g., SmsNotification).// app/Providers/VerificationCodeServiceProvider.php
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../../config/verification.php', 'verification');
$this->app->register(\Creonit\VerificationCodeBundle\CreonitVerificationCodeBundle::class);
}
config/verification.php:
'scopes' => [
'phone' => [
'key_pattern' => '/^\+\d{1,3}.*\d{6,7}$/',
'max_age' => 180,
],
],
AbstractCodeGenerator for domain-specific logic (e.g., alphanumeric codes).// app/Facades/VerificationCode.php
public static function generate(string $scope, string $key) { ... }
Notification system for code delivery.Route::middleware(['throttle:6,1'])->group(function () {
Route::post('/verify', [VerificationController::class, 'verify']);
});
routes.yaml → web.php with minimal changes.TestCase may need Laravel-specific mocking.verification.php.config:publish to manage customizations.composer.json.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Redis/DB outage | Codes lost; verification fails | Fallback to DB with longer TTL or local cache. |
| Rate-limit bypass | Brute-force attacks | Integrate spatie/rate-limiter middleware. |
| Custom generator crash | Code generation fails silently | Add retry logic with fallback generator. |
| Configuration misalignment | Invalid scopes/patterns | Validate config on boot with bootstrap/app.php. |
| Code expiration not triggered | Stale codes in storage | Use Laravel scheduler for cleanup. |
VerificationController for API routes.How can I help you explore Laravel packages today?