alexanderpoellmann/laravel-zendesk
最新稳定版本:v0.1.1
Composer 安装命令:
composer require alexanderpoellmann/laravel-zendesk
包简介
A Laravel wrapper for the Zendesk API client
README 文档
README
Installation
You can install the package via composer:
composer require alexanderpoellmann/laravel-zendesk
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-zendesk-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laravel-zendesk-config"
This is the contents of the published config file:
return [ // ];
Don't forget to add the following to your config/services.php:
return [ 'zendesk' => [ 'subdomain' => env('ZENDESK_SUBDOMAIN', null), 'username' => env('ZENDESK_USERNAME', null), 'token' => env('ZENDESK_TOKEN', null) ], ];
Usage
See also https://github.com/zendesk/zendesk_api_client_php/blob/master/README.md.
// Basic usage use AlexanderPoellmann\LaravelZendesk\Zendesk; $zendesk = app(Zendesk::class); // or $zendesk = zendesk(); // Create or update a user $user = zendesk()->createOrUpdateUser( firstName: 'John', lastName: 'Doe', email: 'john@example.com', ); ray($user); // Upload an attachment. $media = $model->getFirstMedia(); // e.g. spatie/laravel-medialibrary $upload = zendesk()->uploadAttachment( filePath: $media->getPath(), mimeType: $media->mime_type, fileName: $media->file_name, ); ray($upload); // Create an anonymous request $request = zendesk()->createAnonymousRequest( firstName: 'John', lastName: 'Doe', email: 'john@example.com', recipientEmailAddress: 'support@example.com', subject: 'Help!', body: '"My printer is on fire!', uploads: [$upload->token], // optional ); ray($request); // Create a ticket $ticket = zendesk()->createTicket( subject: 'The quick brown fox jumps over the lazy dog', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', priority: Priorities::Normal, uploads: [$upload->token], // optional ]); ray($ticket); // Create a ticket by directly accessing the Zendesk API clients tickets() method $ticket = zendesk()->authenticate()->tickets()->create([ 'subject' => 'The quick brown fox jumps over the lazy dog', 'comment' => [ 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ], 'priority' => 'normal' ]); ray($ticket);
Through the Zendesk facade you may access any methods available on the Zendesk\API\Client class (documentation).
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 235
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-28