PHP code example of myleshyson / laravel-quickbooks

1. Go to this page and download the library: Download myleshyson/laravel-quickbooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

myleshyson / laravel-quickbooks example snippets


Myleshyson\LaravelQuickBooks\QuickBooksServiceProvider::class,

// routes/web.php
use Myleshyson\LaravelQuickBooks\Facades\Connection;

Route::get('/connect', function () {
  Connection::start();
});

// routes/web.php
use Myleshyson\LaravelQuickBooks\Facades\Connection;

Route::get('/disconnect', function () {
  Connection::stop();
});

// routes/web.php
use Myleshyson\LaravelQuickBooks\Facades\Connection;

Route::get('/check-connection', function () {
  dd(Connection::check());
  //true
});

Customer::create(array $data);

Customer::update($id, array $data);

Customer::delete($id);

Customer::find($id);

Customer::get(); //gets all customers associated with your account.

Customer::query('SELECT * FROM CUSTOMER WHERE ...') //put in your own custom query for the Customer table. 

// routes/web.php

use Myleshyson\LaravelQuickBooks\Facades\Customer;

Route::get('/', function () {
    Customer::create([
        'Taxable' => false,
        'BillAddr' => [
            'Line1' => '123 Test Street',
            'City' => 'Dallas',
            'State' => 'Texas',
            'CountrySubDivisionCode' => 'TX',
            'PostalCode' => '12345'
        ],
        'GivenName' => 'Bill',
        'FamilyName' => 'Something',
        'FullyQualifiedName' => "Bill's Surf Shop"
    ]);
});

use Myleshyson\LaravelQuickBooks\Facades\Invoice;

Invoice::create([
  'CustomerRef' => 1,
  'Lines' => [
    [
      'DetailType' => 'SalesItemLineDetail',
      'ItemRef' => 1,
      'Amount' => 20,
      'MarkupInfo' => [
        'PercentBased' => true
      ]
    ],
    [
      'DetailType' => 'TxnTaxDetail',
      'TxnTaxCodeRef' => 8,
      'Lines' => [
        [
          'SomeStuff'
        ],
        [
          'MoreStuff'
        ]
      ]
    ]
   ]
]);

php artisan vendor:publish --tag=quickbooks