- How do I install champs-libres/wopi-lib in a Laravel project?
- Run `composer require champs-libres/wopi-lib` in your project root. The package is framework-agnostic but works seamlessly with Laravel’s routing, middleware, and HTTP handling. No additional Laravel-specific setup is required beyond Composer installation.
- Which Laravel versions does this package support?
- The package is framework-agnostic and supports any Laravel 8.x or 9.x project. It leverages PSR standards (PSR-7, PSR-17, PSR-18) for compatibility. Test thoroughly with your Laravel version, as middleware or routing quirks may require minor adjustments.
- Can I use this library with Collabora Online or OnlyOffice?
- Yes, champs-libres/wopi-lib supports WOPI integration with Collabora Online, OnlyOffice, and Microsoft Office Online (Office 365). The library abstracts protocol details, so you only need to configure your storage backend and endpoints.
- How do I handle file storage (e.g., S3, local filesystem) with this package?
- The library is storage-agnostic. Use Laravel’s Filesystem (e.g., `Storage::disk()`) or Cloud Storage adapters to manage files. For large files, ensure your storage backend supports chunked uploads/downloads, as WOPI relies on streaming for performance.
- What middleware should I use to secure WOPI endpoints in Laravel?
- Use Laravel’s built-in middleware like `auth:sanctum` or `auth:api` to validate WOPI `AccessToken` and `UserId` claims. Exclude CSRF protection for WOPI endpoints if needed, but implement rate limiting (e.g., `throttle`) to prevent abuse.
- How do I implement file locking for concurrent edits in WOPI?
- The library provides a `DocumentLockManager` interface, but you must implement custom logic (e.g., database locks or Redis) to handle concurrent edits. Laravel’s database transactions or queue jobs can help manage lock contention.
- Are there performance concerns for large files (e.g., 100MB+)?
- WOPI supports streaming, but Laravel’s default request handling may not optimize for large files. Test with your storage backend and consider using Laravel Queues to offload file operations. Monitor memory usage and response times under load.
- Can I use this package without a Symfony bundle?
- Yes, this library is framework-agnostic. While a Symfony bundle exists (`champs-libres/wopi-bundle`), you can integrate it directly into Laravel by mapping WOPI endpoints to controllers and using the provided interfaces (e.g., `Wopi`, `DocumentManager`).
- How do I validate WOPI tokens (e.g., JWT) in Laravel?
- Use Laravel Sanctum or Passport to validate WOPI `AccessToken`. Ensure token expiration and revocation align with WOPI’s requirements. Custom middleware can decode and verify tokens before processing WOPI requests.
- What testing tools or benchmarks are available for this package?
- The package includes PHPSpec tests, GrumPHP inspections, and Infection mutation testing. Run `composer phpspec` or `composer infection` to verify quality. For Laravel integration, test WOPI endpoints with real Office clients (e.g., Office Online) and simulate concurrent requests.