PHP code example of wiserwebsolutions / laravel-boarddocs-scraper

1. Go to this page and download the library: Download wiserwebsolutions/laravel-boarddocs-scraper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wiserwebsolutions / laravel-boarddocs-scraper example snippets


BoardDocs()->site('pa/phoe')
    ->committees()->first()
    ->agenda()->withAttachments()
    ->toPdf()
    ->save();

use BoardDocsScraper\Facades\BoardDocs;

// Discover committees (cached)
$committees = BoardDocs::site('pa/phoe')->committees();      // Collection<Committee>
$board = BoardDocs::site('pa/phoe')->committeeNamed('Directors');

// Meetings for a committee (newest first, cached)
$meetings = $board->meetings();                              // Collection<Meeting>
$latest   = $board->latest();                                // ?Meeting

// Agenda for a meeting
$agenda = $latest->agenda();
$agenda->items();          // Collection<AgendaItemData>
$agenda->attachments();    // Collection<AttachmentData> (metadata; no download)
$agenda->text();           // plain-text agenda summary

// Render a self-contained PDF
$pdf = $agenda->withAttachments()->toPdf();
$pdf->pageCount();                     // int
$pdf->attachments();                   // SavedAttachment[]
$pdf->save();                          // -> "boarddocs-private/pa-phoe/Public/<committee>/<date>-Agenda.pdf"
$pdf->save('custom/path.pdf', 'r2');   // any Laravel disk
return $pdf->response();               // inline PDF HTTP response

BoardDocs()->site('pa/phoe')->committees()->first()->agenda()->withAttachments()->toPdf();

$client = BoardDocs::client('pa/phoe');
$client->discoverCommittees();
$client->listMeetings($committeeId);
$client->fetchPrintAgendaHtml($meetingId, $committeeId);
$client->fetchAgendaHtml($meetingId, $committeeId);
$client->fetchItemAttachments($itemId, $committeeId);   // AttachmentData[]
$client->getBytes($fileUrl);                            // raw attachment bytes
$client->downloadToFile($fileUrl, $destinationPath);    // streamed to disk instead

use BoardDocsScraper\Ai\BoardDocsAgent;

$answer = (new BoardDocsAgent)->prompt('What did the Policy Committee decide about edtech?');

use BoardDocsScraper\Ai\Tools\SearchAgendasTool;
use BoardDocsScraper\Ai\Tools\GetMeetingTool;
use BoardDocsScraper\Ai\Tools\ListCommitteesTool;

class MyAgent implements Agent, HasTools
{
    use Promptable;

    public function tools(): iterable
    {
        return [new SearchAgendasTool, new GetMeetingTool, new ListCommitteesTool];
    }
}

   use Laravel\Ai\Stores;

   $store = Stores::create('BoardDocs Agendas');
   // put $store->id in .env as BOARDDOCS_VECTOR_STORE_ID
   

use BoardDocsScraper\Pdf\Templates\PdfTemplate;

class MyTemplate implements PdfTemplate
{
    public function styleBlock(): string
    {
        // A <style> block for TCPDF's writeHTML(). TCPDF's CSS parser only
        // understands a small subset (core PDF fonts, no flexbox/grid,
        // unreliable borders on non-table elements) — keep this simple.
        return '<style>body { font-family: helvetica; font-size: 10pt; }</style>';
    }

    public function document(string $body, string $baseUrl): string
    {
        // A full HTML document for the browsershot engine, which renders with
        // real headless Chrome and supports the full CSS spec.
        return "<!DOCTYPE html><html><head><style>...</style></head><body>{$body}</body></html>";
    }
}

'pdf' => [
    'template' => 'mine',
    'templates' => [
        'mine' => \App\Pdf\MyTemplate::class,
    ],
],
bash
php artisan boarddocs:prefetch --site=pa/phoe
php artisan boarddocs:prefetch --no-attachments   # only fetch agenda HTML

php artisan boarddocs:build --site=pa/phoe        # builds whatever prefetch already archived
bash
# From the unblocked machine, against the shared disk:
php artisan boarddocs:prefetch --site=pa/phoe

# On the deployed server, whenever you like — makes zero BoardDocs requests:
php artisan boarddocs:build --site=pa/phoe
json
{"path":"pa-phoe/Public/Policy Committee/2026-06-01-Agenda.pdf","district":"pa-phoe",
 "visibility":"Public","committee":"Policy Committee","date":"2026-06-01","page_count":7,
 "agenda_text":"…","attachments":[{"title":"May 18, 2026 Policy Minutes.pdf","page":4}]}
bash
php artisan boarddocs:ai-search "What did the Policy Committee decide about edtech?"
bash
   php artisan boarddocs:sync-vector