PHP code example of onwwward / laravel-bugherd
1. Go to this page and download the library: Download onwwward/laravel-bugherd library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onwwward / laravel-bugherd example snippets
...
Onwwward\Bugherd\BugherdServiceProvider::class,
...
...
'Bugherd' => Onwwward\Bugherd\Facade\Bugherd::class,
...
...
$app->register(Onwwward\Bugherd\BugherdServiceProvider::class);
...
...
$app->withFacades();
...
...
class_alias('Onwwward\Bugherd\Facades\Bugherd', 'Bugherd');
...
...
return [
'apikey' => 'YOUR_API_KEY'
];
...
use Onwwward/Bugherd/Facades/Bugherd;
Bugherd::api('user')->all();
protected $protected;
public function __construct(Bugherd/Client $bugherd)
{
$this->bugherd = $bugherd;
}
$bugherd = $this->app->make('bugherd');
$bugherd->api('user')->all();
$bugherd = app('bugherd');
$bugherd->api('user')->all();
/** Projects **/
// Get all projects
$projects = Bugherd::api('project')->all();
// Get all active projects
$active_projects = $bugherd->api('project')->allActive();
// Get all projects with name/id pairs
$projects = $bugherd->api('project')->listing($forceUpdate, $reverse);
// Get all active projects with name/id pairs
$active_projects = $bugherd->api('project')->listingActive($forceUpdate, $reverse);
// Get project id given its name
$id = $bugherd->api('project')->getIdByName($name);
// Get a project
$project = $bugherd->api('project')->show($id);
// Create a project
$project = $bugherd->api('project')->create(array(
'name' => 'Name of the Project',
'devurl' => 'http://example.com/',
'is_active' => true,
'is_public' => false,
));
/** Users **/
// Get all users
$users = $bugherd->api('user')->all();
// Get all guests
$guests = $bugherd->api('user')->getGuests();
// Get all members
$members = $bugherd->api('user')->getMembers();
/ Tasks **/
// Get a task
$task = $bugherd->api('task')->show($projectId, $taskId);
// Create a task
$task = $bugherd->api('task')->create($projectId, array(
'description' => 'Some description',
'requester_id' => $requester_id,
'requester_email' => $requester_email
));
// Update a task
$task = $bugherd->api('task')->update($projectId, $taskId, array(
'description' => 'Some new description',
));
// Get all tasks
$tasks = $bugherd->api('task')->all($projectId, array(
'status' => 'backlog',
'priority' => 'critical'
));
/** Organization **/
// Get organization information
$organization = $bugherd->api('organization')->show();
/** Comments **/
// Create a comment
$comment = $bugherd->api('comment')->create($projectId, $taskId, array(
'text' => 'some comment',
'user_id' => $user_id,
'user_email' => $user_email
));
// Get all comments
$comments = $bugherd->api('comment')->all($projectId, $taskId);
/** Webhooks **/
// Get all webhooks
$webhooks = $bugherd->api('webhook')->all();
// Create a webhook
$webhook = $bugherd->api('webhook')->create(array(
'target_url' => 'http://example.com/tasks/create',
'event' => 'task_create' // this could be task_update, task_destroy, comment
));
// Delete a webhook
$bugherd->api('webhook')->remove($webhookId);
config/app.php
config/app.php
bootstrap/app.php
bootstrap/app.php