> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Pièces jointes

> Découvrez comment attacher des fichiers, des répertoires, des sélections et des blobs pour l'envoi de prompts avec Laravel Copilot SDK.

## Pièces jointes de fichiers

Spécifiez fichiers ou répertoires sous forme de tableau comme suit.

```php theme={null}
use Revolution\Copilot\Facades\Copilot;

$attachments = [
    [
        'type' => 'file',
        'path' => '/path/to/file.php',
        'displayName' => 'My File',// facultatif
    ],
    [
        'type' => 'directory',
        'path' => '/path/to/dir/',
        'displayName' => 'dir',// facultatif
    ],
    [
        'type' => 'selection',
        'filePath' => '/path/to/file.php',
        'displayName' => 'My File',// requis
        'selection' => [
            'start' => ['line' => 1, 'character' => 10],
            'end' => ['line' => 5, 'character' => 10],
        ],
        'text' => '...',
    ],
    [
        'type' => 'blob',
        'data' => base64_encode(file_get_contents('/path/to/image.png')),
        'mimeType' => 'image/png',
        'displayName' => 'screenshot.png',// facultatif
    ],
];

$response = Copilot::run(prompt: '...', attachments: $attachments);
```

Comme ce format est difficile à mémoriser, un helper est fourni pour en faciliter l'usage.

```php theme={null}
use Revolution\Copilot\Facades\Copilot;
use Revolution\Copilot\Support\Attachment;

$attachments = [
    Attachment::file(path: '/path/to/file.php', displayName: 'My File'),
    Attachment::directory(path: '/path/to/dir/', displayName: 'dir'),
    Attachment::selection(filePath: '/path/to/file.php', displayName: 'My File', selection: ['start' => ['line' => 1, 'character' => 10], 'end' => ['line' => 5, 'character' => 10]], text: '...'),
    Attachment::blob(data: base64_encode(file_get_contents('/path/to/image.png')), mimeType: 'image/png', displayName: 'screenshot.png'),
];

$response = Copilot::run(prompt: '...', attachments: $attachments);
```

## Pièces jointes de type Blob

Le type `blob` sert à attacher inline des données encodées en Base64. Vous pouvez envoyer directement des données binaires (images, etc.) sans passer par des E/S disque.

```php theme={null}
use Revolution\Copilot\Support\Attachment;

// Encode un fichier image en Base64 et l'attache
$attachment = Attachment::blob(
    data: base64_encode(file_get_contents('/path/to/image.png')),
    mimeType: 'image/png',
    displayName: 'screenshot.png',
);
```

<Info>
  `selection` n'est pas encore documenté dans le SDK officiel, les détails restent flous. `github_reference` est également peu documenté officiellement et sera pris en charge ultérieurement.
</Info>

<Info>
  Pour les dernières informations, consultez le [dépôt GitHub](https://github.com/invokable/laravel-copilot-sdk).
</Info>


## Related topics

- [Pilote Amazon Bedrock pour Laravel AI SDK](/fr/packages/laravel-amazon-bedrock.md)
- [Laravel Notification for Discord (Webhook)](/fr/packages/laravel-notification-discord-webhook.md)
- [Laravel AI SDK](/fr/ai-sdk.md)
- [Techniques pratiques de Laravel Telescope](/fr/blog/telescope-introduction.md)
- [Mises à jour Laravel — juin 2026](/fr/blog/changelog/202606.md)
