Skip to content

Transform into Laravel package with service provider and facade#40

Open
gigerIT wants to merge 2 commits intomainfrom
claude/laravel-package-conversion-1tKNU
Open

Transform into Laravel package with service provider and facade#40
gigerIT wants to merge 2 commits intomainfrom
claude/laravel-package-conversion-1tKNU

Conversation

@gigerIT
Copy link
Owner

@gigerIT gigerIT commented Feb 1, 2026

Summary

This PR transforms the Bexio API client from a framework-agnostic PHP library into a full-featured Laravel package with service provider integration, configuration management, and a facade for convenient access.

Key Changes

  • Laravel Integration: Added BexioServiceProvider for automatic service registration and configuration publishing
  • Configuration Management: Created config/bexio.php with support for both Personal Access Token and OAuth2 authentication methods
  • Facade Support: Added Bexio facade for convenient access to the client throughout Laravel applications
  • Environment Configuration: Added .env.example with all required and optional environment variables
  • Dependency Updates:
    • Updated PHP requirement from 8.4 to 8.2 for broader compatibility
    • Added illuminate/support as a direct dependency
    • Removed gigerit/spatie-laravel-data-standalone (no longer needed with Laravel)
    • Added orchestra/testbench for Laravel testing support
  • Documentation: Completely rewrote README with Laravel-specific examples including:
    • Dependency injection usage
    • Facade usage patterns
    • OAuth2 authentication flow with per-user token management
    • Configuration and installation instructions
  • Testing:
    • Updated test infrastructure to use Orchestra\Testbench for Laravel testing
    • Added ServiceProviderTest to verify service provider functionality
    • Updated TestCase to extend Orchestra\Testbench\TestCase
    • Improved mock client setup for unit tests
  • Version Bump: Updated version from 3.2.0 to 4.0.0 (breaking changes due to Laravel requirement)
  • Cleanup: Removed check-dependency.php helper script (no longer needed)

Notable Implementation Details

  • The service provider automatically resolves authentication from config, supporting both token-based and OAuth2 flows
  • The client is registered as a singleton in the container for consistent usage across the application
  • Configuration can be published via php artisan vendor:publish --tag=bexio-config
  • The package maintains backward compatibility with the core API client while adding Laravel-specific conveniences
  • OAuth2 examples demonstrate token refresh handling and per-user authentication patterns

Breaking Changes

  • Now requires Laravel 10.x, 11.x, or 12.x (previously framework-agnostic)
  • Minimum PHP version increased to 8.2 (from 8.4)
  • Client instantiation now uses dependency injection or facade instead of direct instantiation

https://claude.ai/code/session_01Tuxg8ZEJFKq97FRu5by7pS

BREAKING CHANGE: This package now requires Laravel 10+

- Add BexioServiceProvider for Laravel auto-discovery
- Add config/bexio.php configuration file
- Add Bexio Facade for convenient access
- Remove spatie-data-standalone dependency
- Remove check-dependency.php script
- Remove illuminate/container explicit dependency (Laravel provides it)
- Update composer.json with Laravel package auto-discovery
- Add orchestra/testbench and pest-plugin-laravel for testing
- Update tests to use Testbench for Laravel integration testing
- Update README with Laravel installation instructions
- Lower PHP requirement to 8.2+ for broader compatibility
- Bump version to 4.0.0

https://claude.ai/code/session_01Tuxg8ZEJFKq97FRu5by7pS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants