File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed
alexgeno/phone-verification-bundle/1.0 Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Symfony \Component \DependencyInjection \Loader \Configurator \ContainerConfigurator ;
6+
7+ return static function (ContainerConfigurator $ containerConfigurator ): void {
8+ $ containerConfigurator ->extension ('alex_geno_phone_verification ' , [
9+ 'storage ' => [
10+ 'driver ' => 'redis ' ,
11+ 'redis ' => [
12+ 'connection ' => 'default ' ,
13+ ],
14+ 'mongodb ' => [
15+ 'connection ' => 'default ' ,
16+ ],
17+ ],
18+ 'sender ' => [
19+ 'transport ' => 'vonage ' ,
20+ ],
21+ 'manager ' => [
22+ 'otp ' => [
23+ 'length ' => '%env(int:PHONE_VERIFICATION_OTP_LENGTH)% ' ,
24+ ],
25+ 'rate_limits ' => [
26+ 'initiate ' => [
27+ 'period_secs ' => '%env(int:PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS)% ' ,
28+ 'count ' => '%env(int:PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT)% ' ,
29+ ],
30+ 'complete ' => [
31+ 'period_secs ' => '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS)% ' ,
32+ 'count ' => '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT)% ' ,
33+ ],
34+ ],
35+ ],
36+ ]);
37+ };
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Symfony \Component \Routing \Loader \Configurator \RoutingConfigurator ;
6+
7+ return static function (RoutingConfigurator $ routingConfigurator ): void {
8+ $ routingConfigurator ->add ('phone_verification_initiate ' , '/phone-verification/initiate/{to} ' )
9+ ->controller ('AlexGeno\PhoneVerificationBundle\Controller\PhoneVerificationController::initiate ' )
10+ ->methods (['POST ' ]);
11+
12+ $ routingConfigurator ->add ('phone_verification_complete ' , '/phone-verification/complete/{to}/{otp} ' )
13+ ->controller ('AlexGeno\PhoneVerificationBundle\Controller\PhoneVerificationController::complete ' )
14+ ->methods (['POST ' ]);
15+ };
Original file line number Diff line number Diff line change 1+ {
2+ "bundles" : {
3+ "AlexGeno\\ PhoneVerificationBundle\\ AlexGenoPhoneVerificationBundle" : [" all" ]
4+ },
5+ "copy-from-recipe" : {
6+ "config/" : " %CONFIG_DIR%/"
7+ },
8+ "env" : {
9+ "#0" : " 1000..9999" ,
10+ "PHONE_VERIFICATION_OTP_LENGTH" : " 4" ,
11+ "#1" : " for every 'to' no more than 10 initiations over 24 hours" ,
12+ "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS" : " 86400" ,
13+ "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT" : " 10" ,
14+ "#2" : " for every 'to' no more than 5 failed completions over 5 minutes" ,
15+ "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS" : " 300" ,
16+ "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT" : " 5"
17+ },
18+ "add-lines" : [
19+ {
20+ "file" : " config/packages/snc_redis.yaml" ,
21+ "position" : " after_target" ,
22+ "warn_if_missing" : true ,
23+ "target" : " clients:" ,
24+ "content" : " default:\n type: predis\n alias: default\n dsn: \" %env(REDIS_URL)%\" "
25+ }
26+ ]
27+ }
You can’t perform that action at this time.
0 commit comments