PHP code example of studylink / mobile-documents

1. Go to this page and download the library: Download studylink/mobile-documents 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/ */

    

studylink / mobile-documents example snippets


protected function plugins(): array
{
    return [
        \StudyLink\Documents\DocumentsServiceProvider::class,
    ];
}

use StudyLink\Documents\Facades\Documents;

Documents::open('/absolute/path/to/file.pdf');            // mime inferred from extension
Documents::pick(['pdf']);                                  // copies into storage/app/documents
Documents::pick(['pdf', 'jpg', 'png'], storage_path('app/inbox'));

#[On('native:StudyLink\Documents\Events\DocumentPicked')]
public function documentPicked(bool $success, array $files = [], int $count = 0, ?string $error = null, bool $cancelled = false): void
{
    // $files[0]['path'] is an absolute path inside the app's storage.
}