Install the Bundle
composer require troopers/taiga-bundle:^0.1
Add to config/bundles.php (Symfony 4+) or AppKernel.php (Symfony 2/3):
TaigaBundle\TaigaBundle::class => ['all' => true],
Configure API Token
Add to .env:
TAIGA_API_TOKEN=your_generated_token_here
Reference in config/packages/taiga.yaml:
taiga:
api_token: '%env(TAIGA_API_TOKEN)%'
First Use Case: Fetch User Projects Inject the service in a controller or command:
use TaigaBundle\Service\TaigaService;
public function __construct(private TaigaService $taiga) {}
public function index()
{
$projects = $this->taiga->projects->getList([
'member' => $this->taiga->users->getMe()->id
]);
// Render or process projects
}
Project Management
$projects = $taiga->projects->getList(['member' => $userId]);
createProject() with required fields (name, description, etc.).updateProject($projectId, ['field' => 'value']).Sprint (Milestone) Operations
$sprints = $taiga->milestones->getList(['project' => $projectId]);
updateUserStory().User Story Handling
$stories = $taiga->userStories->getList(['milestone' => $sprintId]);
$taiga->userStories->update($storyId, ['status' => 'inprogress']);
$taiga->userStoryComments->create($storyId, ['text' => 'Review needed']);
Statistics & Analytics
$stats = $taiga->projects->getProjectIssueStats($projectId);
getMilestoneStats().Event-Driven Integrations
TaigaService in controllers/commands.Taiga\Exceptions\ApiException.
try {
$taiga->userStories->create($projectId, $storyData);
} catch (ApiException $e) {
$this->addFlash('error', $e->getMessage());
}
getList()’s page and per_page params.$projects = $this->cache->get('taiga_projects_' . $userId, function() use ($taiga, $userId) {
return $taiga->projects->getList(['member' => $userId]);
});
Token Permissions
403 Forbidden errors often indicate insufficient permissions.Rate Limiting
Deprecated Methods
taiga/php-sdk@0.1, which may have outdated endpoints.Symfony Version Mismatch
symfony/framework-bundle:^4.0 in composer.json if needed.ID vs. UUID Handling
taiga:
api_token: '%env(TAIGA_API_TOKEN)%'
debug: true # Logs requests/responses
$client = $this->taiga->getClient();
$response = $client->get('/api/v1/projects');
| Error | Cause | Solution |
|---|---|---|
404 Not Found |
Invalid resource ID | Verify UUID format and existence |
400 Bad Request |
Malformed payload | Validate data against API schema |
500 Server Error |
Taiga backend issue | Check Taiga status page |
Custom API Clients Extend the bundle to support additional Taiga endpoints:
// src/Service/TaigaExtendedService.php
class TaigaExtendedService extends TaigaService {
public function getCustomEndpoint() {
return $this->getClient()->get('/api/v1/custom');
}
}
Register as a service in services.yaml:
services:
App\Service\TaigaExtendedService:
parent: 'taiga.api'
Event Listeners Trigger Symfony events on Taiga actions (e.g., story creation):
// src/EventListener/TaigaListener.php
class TaigaListener {
public function onUserStoryCreated(UserStoryEvent $event) {
// Dispatch Symfony event or log
}
}
Bind to the taiga.user_story.created event (if supported) or hook into the SDK directly.
Data Transformers Normalize Taiga responses for your domain:
$project = $taiga->projects->get($projectId);
$normalized = [
'id' => $project->id,
'name' => $project->name,
'slug' => $project->slug,
'stats' => $this->transformStats($project->stats),
];
Testing Mock the Taiga service in PHPUnit:
$mockTaiga = $this->createMock(TaigaService::class);
$mockTaiga->method('projects->getList')->willReturn([$mockProject]);
$this->container->set('taiga.api', $mockTaiga);
updateUserStoriesBulk) for batch updates.Taiga\Webhook\Validator.How can I help you explore Laravel packages today?