Download the PHP package upwebdesign/laravel-infusionsoft without Composer
On this page you can find all versions of the php package upwebdesign/laravel-infusionsoft. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download upwebdesign/laravel-infusionsoft
More information about upwebdesign/laravel-infusionsoft
Files in upwebdesign/laravel-infusionsoft
Package laravel-infusionsoft
Short Description This package provides port of the Infusionsoft SDK utilizing Laravel fascades.
License MIT
Informations about the package laravel-infusionsoft
Laravel Infusionsoft
Buy me a coffee :coffee:
This package eases the oAuth flow for authentication and helps with token management.
New in ^4.1
Added ability to connect to multiple Infusionsoft accounts!
Installation
Use composer to install this package:
For Laravel 5.6+, this package uses service provider and alias auto discovery. You can still add the service provider and alias below in config/app.php
.
in the providers
array and optionally
to the aliases
array.
Configuration
Publish infusionsoft.php
config file.
Environment
Fill in your Client ID and Secret along with the redirect URI and cache store. Default values are used below.
To allow for multiple connected accounts, your .env will need these additional arguments. The first signifies there will be multiple connected Infusionsoft accounts, the second is a JSON encoded and escaped string with your API credentials. The array has identifying keys that will be explained later when making API calls.
Credentials
Once you have all the necessary authorization information entered in your .env
we can begin the authorization process.
You may access the route /infusionsoft/auth
to begin the authorization process. This route will generate the necessary authorization URL to infusionsoft and redirect you to your Infusionsoft application. You must log into Infusionsoft and authorize your app to use the Infusionsoft API. Once you allow
, you will be redirected back to your application /infusionsoft/auth/callback
. Here you will either receive an exception or a successful message.
When using multiple connected accounts, your authorization URLs will change with your identifying keys. For example, /infusionsoft/account1/auth
and /infusionsoft/account1/auth/callback
for each respective account you want to connect.
Redirect URI
INFUSIONSOFT_REDIRECT_URI if used, will override the callback from Infusionsoft and will result in the infusionsoft.token
to not get created. This means you will need to handle the authorization code returned back from Infusionsoft to request an access token.
For multiple account connections, the redirect URI needs to follow this pattern:
Token Name & Cache
Token name default is infusionsoft.token
, but can be overridden by INFUSIONSOFT_TOKEN_NAME. By default the cache store is set to file
, but can be any cache store you have set up in your application and can be overridden by INFUSIONSOFT_CACHE.
For multiple account connections, the account keys will be appended to the infusionsoft.token
name, for example:
Refresh Access Tokens
While this package helps with keeping access tokens refreshed using refresh tokens, there may be instances where this is not best practice. For example, in an environment where the application is load balanced between two or more servers. It is entirely possible during the refresh action, one call could use an expired or invalid access token. To remedy this, a scheduled command is preferred.
Since Infusionsoft access tokens expire after 24 hours it is recommended to refresh the access tokens twice a day. A command is already registered to be used by your application. However, you will need to schedule it in your Console/Kernel.php
file.
Try
There may be instances where Infusionsoft just fails an API call (happens often enough) and I've always struggled with constantly creating do/while or while loops all the time. In V4.2.0 I have introduces a try
method to help alleviate this burden.
The method:
An example:
Laravel ships with a retry
function, however, the try
method sends the instance of the class and the number of tries back through the callback function in case they are needed. So another way it could be written:
Lumen
Register the service provider
Add Infusionsoft configuration bootstrap/app.php
Activate filesystems
config/filesystems.php
See a sample filesystems.php config file. https://github.com/laravel/laravel/blob/master/config/filesystems.php
Add our configuration bootstrap/app.php
Add Infusionsoft facade (optional)
:warning: For multiple account connections, the
InfusionsoftFacade
will not longer work.
You must invoke the class directly:
Buy me a coffee :coffee:
License
Upwebdesign/Infusionsoft & Infusionsoft SDK is free software distributed under the terms of the MIT license.