Skip to content

marsender/symfony-webhook

Repository files navigation

symfony-webhook

CI Code Coverage

This project is a starter webapp with Symfony 7 to setup webhooks.

References :

Requirements

This project require the following to get started :

  • PHP 8.2

Install

Clone Symfony webhook repository

git clone git@github.com:marsender/symfony-webhook.git
cd symfony-webhook

Install php dependencies

composer install
sudo chown -R www-data:$USER var

Install importmap vendor files

bin/console importmap:install

Build for production

composer cache-clear
bin/console asset-map:compile

or use the command

composer deploy

Config

Setup mattermost config in the env file

nano .env.local
# Set authentication: either the permanent auth token or the mattermost login user and password
# Set board api v2 url and yaml config file

Setup Github to send the webhooks to your application url

  • Go to Settings | Webhooks | Settings tab
    • Set the Payload URL with your app url, eg: https://webhook.host/webhook/github
    • Set the Content type to: application/json
    • Set "Which events would you like to trigger this webhook?" to "Let me select individual events."
      • Select at least the "Issues" checkbox

Delopper instructions

Debugging: Seeing All Mapped Assets

bin/console debug:asset-map --full

## Update importmap packages

# List outedated packages
bin/console importmap:outdated
# Update oudated packages
bin/console importmap:update # add packagename to update only one package

## Install ES Module Shims for older browsers compatibility

bin/console importmap:require es-module-shims

Create webhook files and select request matchers

bin/console make:webhook

Symfony Docker

If not already done, install Docker Compose (v2.10+)

Read the official doc

Build the Docker images

docker compose build --no-cache --pull

Start the project

HTTP_PORT=8000 \
HTTPS_PORT=4443 \
HTTP3_PORT=4443 \
docker compose up -d

Test database

docker compose exec php bin/console dbal:run-sql -q "SELECT 1" && echo "OK" || echo "Connection is not working"

Debug container

docker ps
docker exec -ti `container-id` /bin/bash # Enter the container
docker logs --tail 500 --follow --timestamps `container-id` # Display container logs

Recreate database

docker compose exec php bin/console doctrine:database:drop --force --if-exists
docker compose exec php bin/console doctrine:database:create --if-not-exists
docker compose exec php bin/console doctrine:schema:update --force --complete
docker compose exec php bin/console doctrine:schema:validate
docker compose exec php bin/console doctrine:fixtures:load -n

Test app

docker compose exec php composer test

To add a package available for the version of php configured for the docker container (and not your host)

docker compose exec php composer require `package-name`

Browse https//localhost:4443

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published