onix-systems-php / hyperf-support
Support module for Hyperf web applications
Installs: 284
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 0
Type:extension
Requires
- php: >=8.1
- friendsofhyperf/helpers: ^3.1.57
- hyperf/di: >=3.1.52
- hyperf/framework: ^3.1.42
- hyperf/guzzle: ^3.1.42
- onix-systems-php/hyperf-actions-log: ^1.2.1
- onix-systems-php/hyperf-core: >=1.2.5
- onix-systems-php/hyperf-file-upload: ^1.3
- zircote/swagger-php: ^4.11.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.71
- phpstan/phpstan: ^2.1.8
- phpunit/phpunit: ^10.5.45
- symfony/var-dumper: ^7.2.3
README
Hyperf-support is a package for fluently managing your tickets and comments within Slack, Trello and other systems. Made by onix-systems-php
Installation:
composer require onix-systems-php/hyperf-support
Publishing the config:
php bin/hyperf.php vendor:publish onix-systems-php/hyperf-support
Configuration
Configure app
domain
- application url e.g.(https://github.com).name
- application name.team_name
- name of your support team.user_model_class
- User model path. Then implementOnixSystemsPHP\HyperfSupport\Contract\SupportUserInterface
contract in the model class.
Configure integrations.trello
key
- API Key. (You may find it here: https://trello.com/power-ups/admin)token
- Authorization token.webhook_url
-app.domain
+/v1/support/webhooks/trello
.board_name
- Trello board name.members
- For each type of ticket specify members which should be attached to the card on Trello.lists
- Specify mapping for each status of ticket with corresponding list on Trello.custom_fields
- Determine which custom fields should be on card on Trello.trigger_lists
- Specify trigger lists on Trello. These lists determine whether to notify users if the ticket moved in one of these lists.is_private_discussion
- This option must betrue
orfalse
. Iftrue
, discussion under the ticket on Trello will be private and anyone can see it except on Trello.keys_to_source
- Specifyyour_api_username
=>your_source
.
Configure integrations.slack
token
- Bot Authorization key.channel_id
- Slack channel id.- Don't forget to enable subscriptions for your Slack bot and specify request URL:
app.domain
+/v1/support/webhooks/trello
. app_icon
- Your application's icon url. e.g.trello_icon
- Trello icon url. (optional)members
- For each type of ticket specify members which should be mentioned on Slack ticket. Without '@'.custom_fields
- Determine which custom fields should be showed on Slack ticket.is_private_discussion
- This option must betrue
orfalse
. Iftrue
, discussion under the ticket on Slack will be private and anyone can see it except on Slack.keys_to_source
- Specifyyour_slack_channel_id
=>your_source
.
Configure routes
require_once './vendor/onix-systems-php/hyperf-support/publish/routes.php';
Basic Usage
Creating simple ticket:
Try to send this JSON
to /v1/support/tickets
via POST
method.
{ "source": "default", "title": "Lorem ipsum.", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "custom_fields": { "type": "Tweak", "level": 3, "priority": "Medium", "status": "New" }, "page_url": "https://google.com" }
You should get something like this object:
{ "id": 1, "title": "Lorem ipsum.", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", "source": "default", "custom_fields": { "type": "Tweak", "level": 3, "status": "New", "priority": "Medium" }, "created_by": 6, "modified_by": null, "deleted_by": null, "completed_at": null, "trello_id": "660bc45ce19c204556caf1f5", "trello_short_link": "qTHPdFoL", "slack_id": "1712047194.779679", "page_url": null, "created_at": "2024-04-02 08:39:54", "updated_at": "2024-04-02 08:40:36", "deleted_at": null, "files": [] }
Finally, it should appear on Slack and Trello.
Creating ticket with files:
Logic the same as for creating simple ticket, but you need to pass array with files' IDs:
{ ... "files": [1, 2, 3] }
Finally, the ticket should appear on Slack and Trello with attached files.
Updating ticket on Trello.
Once the ticket.done_status
is "Done" everytime when ticket moved to Done list on Trello the ticket will be marked as "completed".