Installation Add the package via Composer:
composer require xlabs/boardbundle
Publish the configuration (if needed):
php artisan vendor:publish --provider="Xlabs\BoardBundle\BoardBundle" --tag=config
Basic Setup
Register the bundle in config/app.php under providers:
Xlabs\BoardBundle\BoardBundle::class,
First Use Case: Displaying a Board
Inject the BoardManager service into a controller or service:
use Xlabs\BoardBundle\Services\BoardManager;
class BoardController extends Controller
{
protected $boardManager;
public function __construct(BoardManager $boardManager)
{
$this->boardManager = $boardManager;
}
public function showBoard()
{
$board = $this->boardManager->getBoard('default');
return view('board.show', compact('board'));
}
}
Configuration
Check config/board.php for default settings (e.g., board storage, caching, or API endpoints).
Board Creation & Management
Dynamically create boards via the BoardManager:
$board = $this->boardManager->createBoard([
'name' => 'Project Backlog',
'columns' => ['To Do', 'In Progress', 'Done'],
]);
Card Operations Add cards to a board column:
$card = $this->boardManager->addCardToColumn('board_id', 'column_id', [
'title' => 'Fix Login Bug',
'description' => 'User cannot log in...',
]);
Integration with Eloquent If the bundle uses Eloquent models, extend them for custom logic:
namespace App\Models;
use Xlabs\BoardBundle\Models\Board;
class CustomBoard extends Board
{
protected static function boot()
{
parent::boot();
static::addGlobalScope(new CustomBoardScope());
}
}
API-Driven Boards Fetch boards via API (if supported):
$boards = $this->boardManager->fetchBoardsFromApi('https://api.example.com/boards');
Event Listeners Listen for board/card updates:
// In EventServiceProvider
protected $listen = [
'Xlabs\BoardBundle\Events\BoardUpdated' => [
'App\Listeners\LogBoardUpdate',
],
];
auth or custom BoardAccess).BoardManager in unit tests:
$this->mock(BoardManager::class)->shouldReceive('getBoard')->andReturn($mockBoard);
Missing Configuration
config/board.php is published and updated if the bundle requires custom paths (e.g., storage for boards).Database Migrations
php artisan migrate
API Rate Limits
Namespace Collisions
Board, Card, or similar names. Prefix custom models/classes to avoid conflicts.Caching Quirks
php artisan cache:clear
php artisan view:clear
Log Board Operations Enable debug mode and log actions:
\Log::debug('Board created:', ['data' => $board->toArray()]);
Check for Exceptions Wrap bundle calls in try-catch:
try {
$board = $this->boardManager->getBoard('invalid_id');
} catch (\Xlabs\BoardBundle\Exceptions\BoardNotFoundException $e) {
abort(404, 'Board not found');
}
Inspect Raw Data Dump board/card data to verify structure:
dd($this->boardManager->getBoard('default')->toArray());
Custom Board Storage Override storage logic by binding a custom repository:
$this->app->bind(
\Xlabs\BoardBundle\Repositories\BoardRepository::class,
\App\Repositories\CustomBoardRepository::class
);
Add Fields to Cards/Boards Extend Eloquent models and migrations:
// app/Models/Card.php
class Card extends \Xlabs\BoardBundle\Models\Card
{
protected $casts = [
'priority' => 'integer',
];
}
Custom Board Views Override Blade templates by publishing views:
php artisan vendor:publish --tag=board-views
Then modify resources/views/vendor/board/....
WebSocket Updates If real-time updates are needed, integrate with Laravel Echo/Pusher for live card/board changes.
API Extensions Add custom endpoints by extending the bundle’s routes:
// routes/board.php
Route::post('/boards/{board}/export', [BoardController::class, 'export']);
How can I help you explore Laravel packages today?