codebar-ag/laravel-miro
最新稳定版本:v0.4.0
Composer 安装命令:
composer require codebar-ag/laravel-miro
包简介
A simple way to interact with the Miro API in Laravel
README 文档
README
This package was developed to give you a quick start to the Miro API.
📑 Table of Contents
- What is Miro?
- Requirements
- Installation
- Laravel Boost Skill
- Usage
- API Reference
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
💡 What is Miro?
Miro is an online collaborative whiteboard platform that enables teams to work effectively together, from brainstorming with digital sticky notes to planning and managing agile workflows.
🛠 Requirements
| Package | PHP | Laravel |
|---|---|---|
| v0.1.1 | ^8.4 | ^12.0 | ^13.0 |
⚙️ Installation
You can install the package via composer:
composer require codebar-ag/laravel-miro
Optionally, you can publish the config file with:
php artisan vendor:publish --tag="laravel-miro-config"
Add your Miro access token to your .env file:
MIRO_ACCESS_TOKEN=your_access_token_here
You can generate a personal access token at miro.com/app/settings/user-profile/apps.
🤖 Laravel Boost Skill
This package includes a Laravel Boost skill. If you use Laravel Boost in your project, the skill is automatically installed when you run:
php artisan boost:install
The skill provides AI agents with full context about the package — available methods, DTOs, response handling, and usage patterns.
🚀 Usage
All methods are available via the Miro facade and return a typed Response object.
use CodebarAg\Miro\Facades\Miro; $response = Miro::getBoard('board_id');
Response Handling
All *Response objects expose the following methods:
$response->successful(); // bool $response->failed(); // bool $response->status(); // int (e.g. 200, 404, 429) $response->error(); // ?string — null on success $response->errorCode(); // ?string — null on success $response->dto(); // typed DTO or array of DTOs, null on failure
Check successful() before accessing the DTO — no try/catch needed for API errors like 404, 429, or 400.
$response = Miro::getBoard('board_id'); if ($response->successful()) { $board = $response->dto(); // BoardDto } else { $response->status(); // e.g. 404 $response->error(); // e.g. "Board not found" $response->errorCode(); // e.g. "board_not_found" }
DTOs
We provide DTOs for the following:
| DTO | Fields |
|---|---|
BoardDto |
id, name, description, type, viewLink, teamId, projectId, createdAt, modifiedAt |
BoardItemDto |
id, type, data, position, geometry, createdAt, modifiedAt, parentId |
StickyNoteDto |
id, type, content, shape, fillColor, textAlign, textAlignVertical, positionX, positionY, width, height, parentId, createdAt, modifiedAt |
FrameDto |
id, type, title, fillColor, positionX, positionY, width, height, parentId, createdAt, modifiedAt |
API Reference
Boards
use CodebarAg\Miro\Facades\Miro; use CodebarAg\Miro\Dto\Boards\CreateBoardDto; use CodebarAg\Miro\Dto\Boards\GetBoardsDto; use CodebarAg\Miro\Dto\Boards\UpdateBoardDto;
/** * Get All Boards */ $response = Miro::getBoards(); $boards = $response->dto(); // BoardDto[]
/** * Get Boards With Filters */ $response = Miro::getBoards(new GetBoardsDto( teamId: 'team_123', limit: 10, ));
/** * Get A Board */ $response = Miro::getBoard('board_id'); $board = $response->dto(); // BoardDto
/** * Create A Board */ $response = Miro::createBoard(new CreateBoardDto( name: 'My Sprint Board', description: 'Q1 planning board', )); $board = $response->dto(); // BoardDto
/** * Update A Board */ $response = Miro::updateBoard('board_id', new UpdateBoardDto( name: 'Q1 Planning', )); $board = $response->dto(); // BoardDto
/** * Delete A Board */ Miro::deleteBoard('board_id'); // returns Saloon\Http\Response
Board Items
use CodebarAg\Miro\Facades\Miro; use CodebarAg\Miro\Dto\BoardItems\GetBoardItemsDto;
/** * Get All Items On A Board */ $response = Miro::getBoardItems('board_id'); $items = $response->dto(); // BoardItemDto[]
/** * Get Items Filtered By Type */ $response = Miro::getBoardItems('board_id', new GetBoardItemsDto( type: 'sticky_note', ));
/** * Get A Board Item */ $response = Miro::getBoardItem('board_id', 'item_id'); $item = $response->dto(); // BoardItemDto
Sticky Notes
use CodebarAg\Miro\Facades\Miro; use CodebarAg\Miro\Dto\StickyNotes\CreateStickyNoteDto; use CodebarAg\Miro\Dto\StickyNotes\GetStickyNotesDto; use CodebarAg\Miro\Dto\StickyNotes\UpdateStickyNoteDto;
/** * Get All Sticky Notes On A Board */ $response = Miro::getStickyNotes('board_id'); $notes = $response->dto(); // StickyNoteDto[]
/** * Get A Sticky Note */ $response = Miro::getStickyNote('board_id', 'item_id'); $note = $response->dto(); // StickyNoteDto
/** * Create A Sticky Note */ $response = Miro::createStickyNote('board_id', new CreateStickyNoteDto( content: 'Hello World', shape: 'square', fillColor: 'yellow', positionX: 100.0, positionY: 200.0, )); $note = $response->dto(); // StickyNoteDto
/** * Update A Sticky Note */ $response = Miro::updateStickyNote('board_id', 'item_id', new UpdateStickyNoteDto( content: 'Updated content', )); $note = $response->dto(); // StickyNoteDto
/** * Delete A Sticky Note */ Miro::deleteStickyNote('board_id', 'item_id'); // returns Saloon\Http\Response
Frames
use CodebarAg\Miro\Facades\Miro; use CodebarAg\Miro\Dto\Frames\CreateFrameDto; use CodebarAg\Miro\Dto\Frames\GetFramesDto; use CodebarAg\Miro\Dto\Frames\UpdateFrameDto;
/** * Get All Frames On A Board */ $response = Miro::getFrames('board_id'); $frames = $response->dto(); // FrameDto[]
/** * Get A Frame */ $response = Miro::getFrame('board_id', 'item_id'); $frame = $response->dto(); // FrameDto
/** * Create A Frame */ $response = Miro::createFrame('board_id', new CreateFrameDto( title: 'Sprint 1', positionX: 0.0, positionY: 0.0, width: 1920.0, height: 1080.0, )); $frame = $response->dto(); // FrameDto
/** * Update A Frame */ $response = Miro::updateFrame('board_id', 'item_id', new UpdateFrameDto( title: 'Sprint 1 – Updated', )); $frame = $response->dto(); // FrameDto
/** * Delete A Frame */ Miro::deleteFrame('board_id', 'item_id'); // returns Saloon\Http\Response
🧪 Testing
composer test
To run the live API tests against the real Miro API, set your token as an environment variable:
MIRO_ACCESS_TOKEN=your_access_token_here
vendor/bin/pest --group=live
Alternatively, add it to .env.testing in the project root.
📝 Changelog
Please see CHANGELOG for more information on what has changed recently.
⚒️ Contributing
Please see CONTRIBUTING for details.
🔒️ Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
🙏 Credits
📄 License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-18