spatie/laravel-float-sdk
Laravel-friendly SDK for interacting with the Float.com API (v3). Configure your API token and user agent via .env/config and use the provided FloatClient to access Float endpoints. Not a full API implementation; contributions welcome.
Pros:
FloatClient), aligning with Laravel’s dependency management and testing paradigms (e.g., mocking FloatClient in unit tests).users(), projects(), etc.) follow single-responsibility principles, making the SDK easy to extend (e.g., add custom endpoints via service providers).Params classes (e.g., GetUsersParams) for API filtering, reducing runtime errors from malformed queries.page, perPage) and sorting, critical for large datasets (e.g., user lists, project tasks).fields: ['id', 'name']) to optimize performance and reduce payload sizes.Cons:
create(), update(), or delete() methods). Requires direct API calls or future SDK updates for CRUD operations.422 Unprocessable Entity) may need additional handling in application code.guzzlehttp/guzzle, symfony/http-client), which may introduce version conflicts in larger Laravel projects.FloatClient in Laravel’s container, enabling global access via dependency injection..env + published config file), aligning with Laravel’s 12-factor app principles.FLOAT_API_TOKEN), matching Float’s OAuth-like token-based auth.| Risk Area | Severity | Mitigation |
|---|---|---|
| Partial API Coverage | High | Document gaps; plan for direct API calls or SDK extensions. |
| Read-Only Limitations | Medium | Monitor for write-support updates or implement a wrapper service. |
| Saloon Dependencies | Low | Test for version conflicts early; use composer why-not to resolve issues. |
| Error Handling | Medium | Extend FloatClient with custom error handlers (e.g., Saloon\Exceptions\Exception). |
| Single-Object Parsing | Low | 1.0.1 fix resolves this; verify in staging before production. |
| Pagination Performance | Medium | Benchmark large dataset fetches (e.g., 10K+ users); consider chunking. |
| Multi-Tenant Isolation | High | Ensure tenant-specific API tokens are managed (e.g., per-tenant .env). |
422 Unprocessable Entity)? Will you extend the SDK or add middleware?FloatClient integrates seamlessly with Laravel’s IoC container, enabling dependency injection in controllers, commands, or jobs.php artisan float:sync-expenses).FloatClient easily with PHPUnit or Pest for unit/feature tests.| Step | Action | Tools/Commands |
|---|---|---|
| 1. Setup | Install package and configure .env. |
composer require spatie/laravel-float-sdk |
| 2. Publish Config | Publish config file for customization. | php artisan vendor:publish --tag=float-sdk-config |
| 3. Dependency Injection | Inject FloatClient into services/controllers. |
Constructor injection (PSR-11 compatible). |
| 4. Test Endpoints | Verify core endpoints (e.g., users(), projects()) work as expected. |
Postman/Newman or Laravel Tinker. |
| 5. Extend SDK | Add missing endpoints or write operations if needed. | Extend FloatClient or create a facade. |
| 6. Error Handling | Implement custom exception handling for Float-specific errors. | Extend Saloon\Exceptions\Exception. |
| 7. Caching | Cache frequent API calls (e.g., user lists) to reduce latency. | Laravel Cache (cache()->remember). |
| 8. Monitoring | Log API calls and errors for observability. | Laravel Log or third-party APM (e.g., Sentry). |
curl, json, and mbstring (standard in Laravel)..env, and test read operations (e.g., users, projects).How can I help you explore Laravel packages today?