Installation:
composer require digitalkaoz/issues-bundle
Add the bundle to app/AppKernel.php:
new Rs\IssuesBundle\RsIssuesBundle(),
Basic Configuration (config.yml):
rs_issues:
github:
- "digitalkaoz/issues" # Track a single repo
First Use Case:
Inject the Rs\IssuesBundle\Service\IssuesService into a controller/service:
use Rs\IssuesBundle\Service\IssuesService;
class IssueController extends Controller
{
public function __construct(private IssuesService $issuesService) {}
public function showIssues()
{
$issues = $this->issuesService->getIssues('github', 'digitalkaoz/issues');
return $this->renderIssues($issues);
}
}
Issue Tracking Integration:
$githubIssues = $issuesService->getIssues('github', 'vendor/repo');
$jiraIssues = $issuesService->getIssues('jira', 'PROJKEY');
Dynamic Repo Matching:
symfony/* or doctrine/(?!common).*).rs_issues:
github:
- "symfony/*"
- "!symfony/symfony" # Exclude a repo
Authentication Handling:
parameters.yml (e.g., GITHUB_TOKEN or JIRA_PASSWORD).rs_issues:
jira:
- "https://jira.com PROJKEY %env(JIRA_USER)% %env(JIRA_PASSWORD)%"
Event-Driven Updates:
post-commit or post-push):
// In a Git hook or command
$issuesService->checkForNewIssues('github', 'digitalkaoz/issues');
Caching:
Cache component):
$cache = $this->container->get('cache.app');
$issues = $cache->get('issues:github:digitalkaoz/issues', function() use ($issuesService) {
return $issuesService->getIssues('github', 'digitalkaoz/issues');
});
Regex Complexity:
- "doctrine/(?!common|lexer)(?!orm)(.*)" # May exclude unintended repos
Authentication Failures:
config.yml are insecure. Always use parameters.yml or environment variables:
# ❌ Avoid
rs_issues:
github:
- "vendor/repo %plaintext_token%"
# ✅ Use
rs_issues:
github:
- "vendor/repo %env(GITHUB_TOKEN)%"
API Rate Limits:
try {
$issues = $issuesService->getIssues('github', 'repo');
} catch (RateLimitExceededException $e) {
sleep(60); // Wait and retry
retry();
}
Bundle Maturity:
Symfony Version Compatibility:
composer.json for symfony/* constraints.Enable Verbose Logging:
Add to config.yml:
rs_issues:
debug: true
Logs will appear in var/log/dev.log.
Inspect Raw API Responses: Override the service to dump responses:
$issuesService->setDebugHandler(function($tracker, $response) {
file_put_contents('debug/issues.json', json_encode($response));
});
Test with Public Repos:
Start with public repos (e.g., symfony/symfony) to avoid auth issues:
rs_issues:
github:
- "symfony/symfony"
Custom Trackers:
Extend the Rs\IssuesBundle\Tracker\TrackerInterface to support new issue trackers (e.g., GitHub Enterprise, Azure DevOps):
class CustomTracker implements TrackerInterface {
public function fetchIssues(string $repo): array {
// Implement custom logic
}
}
Register it in the bundle’s services.
Issue Filtering: Add a filter layer to the service to transform raw issues (e.g., normalize labels or statuses):
$issuesService->addFilter(function(array $issues) {
return array_map(function($issue) {
$issue['status'] = strtolower($issue['status']);
return $issue;
}, $issues);
});
Webhook Integration: Create a command to process webhook payloads and update issues:
// src/Command/ProcessWebhookCommand.php
class ProcessWebhookCommand extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$payload = json_decode(file_get_contents('php://input'), true);
$this->issuesService->handleWebhook($payload);
}
}
How can I help you explore Laravel packages today?