Giter VIP home page Giter VIP logo

laravel-harvest's Introduction

A Laravel wrapper for the Harvest API

Software License Travis Total Downloads

Install

composer require byte5digital/laravel-harvest

If you want to persist harvest data, publish the migration: php artisan vendor:publish --provider="Byte5\LaravelHarvest\LaravelHarvestServiceProvider

If you only want to publish the config file add: --tag="config"

Table of Content

Usage

You can use either the Harvest facade or the Api Manager for any request.

// instantiate api manager
$manager = app()->make('harvest');

Clients

// get Clients with Facade
$result = Harvest::getClients();

// get Clients via ApiManager
$result = $manager->clients->all();

// get Clients by Id
Harvest::getClientsById('12345');
$manager->clients->id('12345');

Company

// get Clients with Facade
$result = Harvest::getCompany();

// get Clients via ApiManager
$result = $manager->company->all();

Contacts

// get Contacts with Facade
$result = Harvest::getContacts();

// get Contacts via ApiManager
$result = $manager->contacts->all();


// get Contacts by Id
Harvest::getContactsById('12345');
$manager->contacts->id('12345');

Estimates

// get Estimates with Facade
$result = Harvest::getEstimates();

// get Estimates via ApiManager
$result = $manager->estimates->all();


// get Estimate by Id
Harvest::getEstimateById('12345');
$manager->estimates->id('12345');

Expenses

// get Expenses with Facade
$result = Harvest::getExpenses();

// get Expenses via ApiManager
$result = $manager->expenses->all();

// get Expense by Id
Harvest::getExpenseById('12345');
$manager->expenses->id('12345');

Expense Categories

// get Expense Category with Facade
Harvest::getExpenseCategorie);

// get Expense Category via ApiManager
$result = $manager->expenses->al);

// get Expense Category by Id
Harvest::getExpenseCategoryById('12345');
$manager->expenseCategory->id('12345');

Users

// get Users with Facade
$result = Harvest::getUsers();

// get Users via ApiManager
$result = $manager->users->all();

// get Users by Id
Harvest::getUsersById('12345');
$manager->users->id('12345');

// get current user
Harvest::getCurrentUser();
$manager->user->me();

Converting Results

$result = Harvest::getUsers();

// convert result to json
$result->toJson();
// convert result to collection
$result->toCollection();
// convert result to paginated collection
$result->toPaginatedCollection();

// get next result page
$result = $result->next();
// get prev result page
$result = $result->previous();

ToDo

  • add usage sections to readme
  • update/create records
  • tests

Testing

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

License

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

laravel-harvest's People

Contributors

naoray avatar

Watchers

 avatar  avatar

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.