Giter Club home page Giter Club logo

laravel-infusionsoft-oauth2's Introduction

laravel-infusionsoft-oauth2

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Laravel package to facilitate the use of the Infusionsoft API using OAUTH2. This packages is quite specific to laravel

Install

Via Composer

$ composer require djaxho/laravel-infusionsoft-oauth2

Installation

(These instructions are for an 'alerady set-up' laravel project with a functioning database set up) Add the service provider for laravel by adding the following line to your 'providers' array in the file congig/app.php

Djaxho\LaravelInfusionsoftOauth2\LaravelInfusionsoftOauth2ServiceProvider::class,

Publish the package files to your project by running:

$ php artisan vendor:publish

Add the following variable to your .env file or u them in your pdate config/laravel-infusionsoft-oauth2.php file with values obtained from your infusionsoft developer account and for ISDK_API_REDIRECT use the uri you are serving your site from (i.e. www.yoursite.dev)

ISDK_API_HOST
ISDK_API_CLIENTID
ISDK_API_CLIENTSECRET
ISDK_API_REDIRECT

Run your database migrations (first make sure you have your database info in your .env file or config files so you can successfully connect to the database of your choosing):

$ php artisan migrate

You may now navigate to your.url/authorize-infusionsoft-api (whichever url you used for ISDK_API_REDIRECT) and click 'authorize.' You will then be taken to infusionsoft to authorize your api connection. At the end of this process you will be led back to the your.url/authorize-infusionsoft-api page with a success message and the oauth2 key stored in your database

Usage

To start using the infusionsoft api after going through the steps above, add this to the top of your php file:

use Djaxho\LaravelInfusionsoftOauth2\Infusionsoft;

And in the methods of your classes (or in the constructor method) you can leverage laravel's automatic dependency injection to instantiate the infusionsoft api singleton. As an example of something you could do to test your api connection in a controller class:

protected $infusionsoft;

public function __construct(Infusionsoft $infusionsoft)
{
    $this->infusionsoft = $infusionsoft;
    var_dump($this->infusionsoft->hasToken());
}

Then you can use the infusionsoft api documentation to make api calls. As a simple example, you would use it liek this:

$updateField = $this->infusionsoft->data()->update('Contact', $contactId, $updateData);

Change log

Please see CHANGELOG for more information on what has changed recently.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-infusionsoft-oauth2's People

Contributors

djaxho avatar markvilludo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

laravel-infusionsoft-oauth2's Issues

I can't get this to work with Auth in Laravel

I am fairly new so I apologize. I had a laravel app set up and I had authentication installed. Then I added your package which went into vendors.
Now I am trying to tie the user_id from Auth to the Infusionsoft oauth record. However I can not figure out how to access Auth from within vendor\djaxho\laravel-infusionsoft-oauth2\src\Http\Controllers\AuthorizeInfusionsoftApiController.php

This is the set up of that file
`<?php

namespace Djaxho\LaravelInfusionsoftOauth2\Http\Controllers;
//namespace App\Http\Controllers\Auth;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use Djaxho\LaravelInfusionsoftOauth2\Infusionsoft;
use Auth;
use Illuminate\Support\ServiceProvider;

print Auth::user()->id;`

And I get this error
(1/1) ErrorException
Trying to get property 'id' of non-object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.