hdinnovations / laravel-polar-api
An API wrapper for the POLAR API.
Fund package maintenance!
polar.sh/HDInnovations
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
Requires (Dev)
- larastan/larastan: ^2.9.8
- laravel/pint: v1.17.3
- nunomaduro/collision: ^8.4.0||^7.10.0
- orchestra/testbench: ^9.5.0||^8.22.0
- pestphp/pest: ^2.35.1
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.4
- pestphp/pest-plugin-type-coverage: ^2.8.6
- phpstan/phpstan-deprecation-rules: ^1.2.1
- phpstan/phpstan-phpunit: ^1.4
- spatie/laravel-ray: ^1.37.1
This package is auto-updated.
Last update: 2024-10-24 21:31:17 UTC
README
Laravel Polar API is a Laravel package that provides an API wrapper for polar.sh API. This package simplifies the process of interacting with the Polar API by providing a set of convenient methods and classes.
Installation
To install the package, you can use Composer:
composer require hdinnovations/laravel-polar-api
Configuration
After installing the package, you need to publish the configuration file:
php artisan vendor:publish --provider="HDInnovations\LaravelPolarApi\Providers\PolarApiServiceProvider"
This command will publish a polar-api.php
file in your config
directory. You can use this file to configure the package.
The configuration file contains the following options:
base_url
: The base URL of the POLAR API.token
: The token (PAT) used to authenticate requests to the POLAR API.
You can also set the POLAR_API_BASE_URL
and POLAR_API_TOKEN
environment variables in your .env
file which is recommended.
Usage Documentation
Please refer to our documentation for detailed information on how to use this package and the endpoints + parameters it supports.
Exceptions
The package throws the following exceptions:
HDInnovations\LaravelPolarApi\Exceptions\PolarApiNotFoundException
: Thrown when the requested resource is not found.HDInnovations\LaravelPolarApi\Exceptions\PolarApiUnprocessableEntityException
: Thrown when the request is invalid.HDInnovations\LaravelPolarApi\Exceptions\PolarApiValidationException
: Thrown when the request validation fails.HDInnovations\LaravelPolarApi\Exceptions\PolarApiUnauthorizedException
: Thrown when the request is unauthorized.
Testing
To run the tests, use the following command:
composer test
Test Coverage
To generate the test coverage, use the following command:
composer test-coverage
Static Analysis
To run static analysis, use the following command:
composer analyze
Type Coverage
To check the type coverage, use the following command:
composer test-type-coverage
License
The package is open-source software licensed under the MIT license.
Roadmap
- Support all GET requests
- Support all POST requests
- Support all PUT requests
- Support all DELETE requests
- Add more exception handling
- Add more examples
- 100% test coverage
- 100% type coverage