-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
2,036 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.php] | ||
indent_size = 4 | ||
|
||
[Makefile] | ||
indent_size = 4 | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.PHONY: fmt | ||
fmt: | ||
./vendor/bin/php-cs-fixer fix -v | ||
# fully_qualified_strict_types not fully applied until | ||
# run twice, hopefully we can remove this in the | ||
# future | ||
./vendor/bin/php-cs-fixer fix -v | ||
|
||
.PHONY: lint | ||
lint: | ||
@./vendor/bin/php-cs-fixer check -v | ||
|
||
.PHONY: test | ||
test: | ||
@./vendor/bin/phpunit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
require __DIR__.'/../../vendor/autoload.php'; | ||
|
||
use UserHub\EventsV1\Event; | ||
use UserHub\Webhook; | ||
|
||
if (PHP_SAPI === 'cli') { | ||
$port = getenv('PORT') ?? '8000'; | ||
echo "php -S localhost:{$port} ".__FILE__.PHP_EOL; | ||
|
||
exit(1); | ||
} | ||
|
||
$signingSecret = getenv('SIGNING_SECRET'); | ||
if (empty($signingSecret)) { | ||
echo 'SIGNING_SECRET required'.PHP_EOL; | ||
|
||
exit(1); | ||
} | ||
|
||
$wh = new Webhook($signingSecret); | ||
|
||
$wh->onEvent(static function (Event $event): void { | ||
error_log('Event: '.$event->type); | ||
|
||
switch ($event->type) { | ||
case 'organizations.changed': | ||
$organization = $event->organizationsChanged->organization; | ||
error_log(" - Organization: {$organization->id} {$organization->displayName}"); | ||
|
||
break; | ||
|
||
case 'users.changed': | ||
$user = $event->usersChanged->user; | ||
error_log(" - User: {$user->id} {$user->displayName}"); | ||
|
||
break; | ||
} | ||
}); | ||
|
||
$wh->handleFromGlobals(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.