PHP code example of conduit-ui / issue

1. Go to this page and download the library: Download conduit-ui/issue 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/ */

    

conduit-ui / issue example snippets


use ConduitUI\Issue\Issue;

// Find and update a single issue
Issue::find('owner/repo', 123)
    ->addLabels(['bug', 'priority-high'])
    ->assignTo('username')
    ->save();

// Bulk operations across multiple issues
Issue::query('owner/repo')
    ->state('open')
    ->label('needs-triage')
    ->get()
    ->each(fn($issue) => $issue
        ->removeLabels(['needs-triage'])
        ->addLabels(['triaged'])
        ->save()
    );

// Add, remove, or replace labels in bulk
Issue::find('owner/repo', 456)
    ->addLabels(['bug', 'urgent'])
    ->removeLabels(['question'])
    ->save();

// Route issues to team members based on labels
Issue::query('owner/repo')
    ->label('frontend')
    ->open()
    ->get()
    ->each(fn($issue) => $issue->assignTo('frontend-team'));

// Close stale issues automatically
Issue::query('owner/repo')
    ->state('open')
    ->updatedBefore(now()->subMonths(6))
    ->get()
    ->each(fn($issue) => $issue->close('Closing due to inactivity'));

Issue::query('owner/repo')
    ->author('username')
    ->assignee('team-member')
    ->labels(['bug', 'priority-high'])
    ->since(now()->subWeek())
    ->sort('created', 'desc')
    ->get();

// Add automated responses
$issue = Issue::find('owner/repo', 789);
$issue->comment('Thanks for reporting! Our team will investigate.');

// Get all comments
$comments = $issue->comments();

use ConduitUI\Issue\Facades\Issue;

// Add a reaction to a comment
$reaction = Issue::createCommentReaction('owner', 'repo', $commentId, '+1');

// List all reactions on a comment
$reactions = Issue::listCommentReactions('owner', 'repo', $commentId);

// Filter reactions by type
$thumbsUp = $reactions->filter(fn($r) => $r->isThumbsUp());

// Remove a reaction
Issue::deleteCommentReaction('owner', 'repo', $commentId, $reactionId);

// Lock heated discussions
$issue->lock('too heated');

// Unlock when ready
$issue->unlock();

use ConduitUI\Issue\Issue;

$issue = Issue::find('owner/repo', 123);
$issues = Issue::query('owner/repo')->open()->get();

use ConduitUI\Issue\IssueManager;

$manager = new IssueManager('owner/repo');
$issue = $manager->find(123);
$issues = $manager->query()->open()->get();

$issue->id;           // int
$issue->number;       // int
$issue->title;        // string
$issue->state;        // 'open' | 'closed'
$issue->author;       // User object
$issue->assignees;    // Collection of User objects
$issue->labels;       // Collection of Label objects
$issue->createdAt;    // Carbon instance
$issue->updatedAt;    // Carbon instance
$issue->closedAt;     // ?Carbon instance

// Label bugs automatically based on title keywords
Issue::query('owner/repo')
    ->state('open')
    ->created('after', now()->subHour())
    ->get()
    ->filter(fn($issue) => str_contains(strtolower($issue->title), 'bug'))
    ->each(fn($issue) => $issue->addLabels(['bug', 'needs-triage']));

// Route issues to on-call team member
$oncall = getOncallEngineer(); // Your function

Issue::query('owner/repo')
    ->label('incident')
    ->open()
    ->get()
    ->each(fn($issue) => $issue->assignTo($oncall));

// Close issues with no activity for 90 days
Issue::query('owner/repo')
    ->state('open')
    ->updatedBefore(now()->subDays(90))
    ->get()
    ->each(function($issue) {
        $issue->comment('Closing due to inactivity. Please reopen if still relevant.');
        $issue->close();
    });
bash
php artisan vendor:publish --tag="issue-config"