Download the PHP package helpscout/api-laravel without Composer
On this page you can find all versions of the php package helpscout/api-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package api-laravel
Help Scout Service Provider and Facade for Laravel and Lumen
This package contains a service provider and facade for use with Laravel and Lumen.
Installation
The Help Scout Service Provider can be installed via Composer by requiring the
helpscout/api-laravel
package in your project's composer.json
.
Then run a composer update
To use the Help Scout Service Provider, you must register the provider when bootstrapping your application.
Lumen
In Lumen find the Register Service Providers
in your bootstrap/app.php
and register the Help Scout Service Provider.
Laravel
In Laravel find the providers
key in your config/app.php
and register the Help Scout Service Provider.
Find the aliases
key in your config/app.php
and add the Help Scout facade alias.
Configuration
This package offers two ways to configure your client from within the service provider. You can use the client_credentials
auth type or you can use the legacy_token
auth type.
Client Credentials Flow
The client_credentials
auth type uses the OAuth2 grant of the same name described on the Mailbox API 2.O Authentication page.
When using this method, if the API client does not have an access_token
when a request is make, it will make a pre-flight request to retrieve that token from the Mailbox 2.0 https://api.helpscout.net/v2/oauth2/token
endpoint. Every subsequent request to the API after that will use the access_token
retrieved in this first request. See this page for more details about the client_credentials
authorization flow.
To use this grant type, set the following environment variables:
Legacy Credentials Flow
To ease the transition of legacy apps to the new API, the API client uses the transition service to exchange the legacy clientId
and apiKey
for an access_token
.
Just as with the client_credentials
flow described above, if the API client does not have an access_token
when attempting an API call, it will make a pre-flight request to the transition service to exchange the legacy credentials for a valid access_token
.
To use this grant type, set the following environment variables:
Changing credentials between requests
If you do not provide credentials when the client is created, you must provide either an access_token
or valid credentials for one of the two auth types described above. You can do this with a concrete instance of the client like so:
To customize the configuration file, publish the package configuration using Artisan.
The settings can be found in the generated config/helpscout.php
configuration file.
Usage
This service provider offers several ways to use the API Client from within your app. You can resolve the client instance from the container by using the helpscout
alias, by specifying the Helpscout\Api\ApiClient
class name, or you may type-hint the client in a class constructor or a method signature. If you configured the client with credentials as described above, there is no further configuration needed.
Use the full class name to get the client from the container.
Use the alias to get the client from the container.
Or, type-hint the client in a constructor or method signature.
Additionally, you can request and resolve specific API Endpoints from the container in a similar fashion. For a list of the endpoints and their aliases, see the ApiClient::AVAILABLE_ENDPOINTS
in the API client library. In the same fashion as the ApiClient
class, the container will return a fully-configured endpoint that is ready for use as long as you specified the auth type and appropriate credentials in your config/helpscout.php
file.
If the HelpScout
facade is registered within the aliases
section of the application configuration, you can also use the
following technique.
Links
All versions of api-laravel with dependencies
helpscout/api Version ~3.0
illuminate/support Version ^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0